Java Code Examples for org.jboss.as.controller.OperationContext#revertReloadRequired()

The following examples show how to use org.jboss.as.controller.OperationContext#revertReloadRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BindingRemoveHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    String name = context.getCurrentAddressValue();
    ServiceName svcName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(name);
    ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceController<?> controller = registry.getService(svcName);
    if (controller != null) {
        // We didn't remove it, we just set reloadRequired
        context.revertReloadRequired();
    } else {
        try {
            BindingAddHandler.installBindingService(context, model, name);
        }catch (UnknownHostException e) {
            throw new OperationFailedException(e.toString());
        }
    }
}
 
Example 2
Source File: JaspiDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    if (context.isResourceServiceRestartAllowed()) {
        ADD.performRuntime(context, operation, model);
    } else {
        context.revertReloadRequired();
    }
}
 
Example 3
Source File: JMXSubsystemRemove.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    if (isRemoveService(context)) {
        JMXSubsystemAdd.launchServices(context, model, auditLoggerInfo, authorizer, securityIdentitySupplier, hostInfoAccessor);
    } else {
        context.revertReloadRequired();
    }
}
 
Example 4
Source File: LdapConnectionRemoveHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
    String name = address.getLastElement().getValue();
    ServiceName svcName = LdapConnectionManagerService.ServiceUtil.createServiceName(name);
    ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceController<?> controller = registry.getService(svcName);
    if (controller != null) {
        // We didn't remove it, we just set reloadRequired
        context.revertReloadRequired();
    } else {
        addHandler.performRuntime(context, operation, model);
    }
}
 
Example 5
Source File: RevertReloadRequiredTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void rollbackRuntime(OperationContext context, ModelNode operation, Resource resource) {
    try {
        context.revertReloadRequired();
    } catch (Throwable t) {
        throwable = t;
    }
}
 
Example 6
Source File: OutboundSocketBindingWriteHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName,
                                     ModelNode valueToRestore, ModelNode valueToRevert, Boolean handback) throws OperationFailedException {
    if (handback != null && handback.booleanValue()) {
        final String bindingName = context.getCurrentAddressValue();
        final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
        // Back to the old service
        revertBindingReinstall(context, bindingName, bindingModel, attributeName, valueToRestore);
    } else {
        context.revertReloadRequired();
    }
}
 
Example 7
Source File: BoundedQueueThreadPoolWriteAttributeHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void applyOperation(final OperationContext context, ModelNode model, String attributeName,
                              ServiceController<?> service, boolean forRollback) throws OperationFailedException {

    final BoundedQueueThreadPoolService pool =  (BoundedQueueThreadPoolService) service.getService();

    if (PoolAttributeDefinitions.KEEPALIVE_TIME.getName().equals(attributeName)) {
        TimeUnit defaultUnit = pool.getKeepAliveUnit();
        final TimeSpec spec = getTimeSpec(context, model, defaultUnit);
        pool.setKeepAlive(spec);
    } else if(PoolAttributeDefinitions.MAX_THREADS.getName().equals(attributeName)) {
        pool.setMaxThreads(PoolAttributeDefinitions.MAX_THREADS.resolveModelAttribute(context, model).asInt());
    } else if(PoolAttributeDefinitions.CORE_THREADS.getName().equals(attributeName)) {
        int coreCount;
        ModelNode coreNode = PoolAttributeDefinitions.CORE_THREADS.resolveModelAttribute(context, model);
        if (coreNode.isDefined()) {
            coreCount = coreNode.asInt();
        } else {
            // Core is same as max
            coreCount = PoolAttributeDefinitions.MAX_THREADS.resolveModelAttribute(context, model).asInt();
        }
        pool.setCoreThreads(coreCount);
    } else if(PoolAttributeDefinitions.QUEUE_LENGTH.getName().equals(attributeName)) {
        if (forRollback) {
            context.revertReloadRequired();
        } else {
            context.reloadRequired();
        }
    } else if (PoolAttributeDefinitions.ALLOW_CORE_TIMEOUT.getName().equals(attributeName)) {
        pool.setAllowCoreTimeout(PoolAttributeDefinitions.ALLOW_CORE_TIMEOUT.resolveModelAttribute(context, model).asBoolean());
    } else if (!forRollback) {
        // Programming bug. Throw a RuntimeException, not OFE, as this is not a client error
        throw ThreadsLogger.ROOT_LOGGER.unsupportedBoundedQueueThreadPoolAttribute(attributeName);
    }
}
 
Example 8
Source File: SecurityRealmAddHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected void rollbackRuntime(OperationContext context, ModelNode operation, Resource resource) {
    if (!context.isBooting() && context.getProcessType() == ProcessType.EMBEDDED_SERVER && context.getRunningMode() == RunningMode.ADMIN_ONLY) {
        context.revertReloadRequired();
    }
}