Java Code Examples for org.jboss.as.controller.ProcessType#isHostController()

The following examples show how to use org.jboss.as.controller.ProcessType#isHostController() . 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: MBeanServerService.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static ServiceController<?> addService(final OperationContext context, final String resolvedDomainName, final String expressionsDomainName, final boolean legacyWithProperPropertyFormat,
                                              final boolean coreMBeanSensitivity,
                                              final ManagedAuditLogger auditLoggerInfo,
                                              final JmxAuthorizer authorizer,
                                              final Supplier<SecurityIdentity> securityIdentitySupplier,
                                              final JmxEffect jmxEffect,
                                              final ProcessType processType, final boolean isMasterHc) {
    final MBeanServerService service = new MBeanServerService(resolvedDomainName, expressionsDomainName, legacyWithProperPropertyFormat,
            coreMBeanSensitivity, auditLoggerInfo, authorizer, securityIdentitySupplier, jmxEffect, processType, isMasterHc);
    final ServiceName modelControllerName = processType.isHostController() ?
            DOMAIN_CONTROLLER_NAME : Services.JBOSS_SERVER_CONTROLLER;
    return context.getServiceTarget().addService(MBeanServerService.SERVICE_NAME, service)
        .setInitialMode(ServiceController.Mode.ACTIVE)
        .addDependency(modelControllerName, ModelController.class, service.modelControllerValue)
        .addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null), NotificationHandlerRegistry.class, service.notificationRegistryValue)
        .addDependency(ManagementModelIntegration.SERVICE_NAME, ManagementModelIntegration.ManagementModelProvider.class, service.managementModelProviderValue)
        .addAliases(LEGACY_MBEAN_SERVER_NAME)
            .install();
}
 
Example 2
Source File: MutabilityChecker.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static MutabilityChecker create(ProcessType processType, boolean isMasterHc) {
    if (processType == ProcessType.STANDALONE_SERVER) {
        return new StandaloneServerChecker();
    } else if (processType.isHostController()) {
        return new HostControllerChecker(isMasterHc);
    }
    return new NonMutableChecker();
}
 
Example 3
Source File: ProcessStateListenerService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void install(CapabilityServiceTarget serviceTarget, ProcessType processType, RunningMode runningMode, String listenerName, ProcessStateListener listener, Map<String, String> properties, int timeout) {
    final CapabilityServiceBuilder<?> builder = serviceTarget.addCapability(PROCESS_STATE_LISTENER_CAPABILITY.fromBaseCapability(listenerName));
    final Supplier<ProcessStateNotifier> psnSupplier = builder.requiresCapability("org.wildfly.management.process-state-notifier", ProcessStateNotifier.class);
    final Supplier<ExecutorService> esSupplier = builder.requiresCapability("org.wildfly.management.executor", ExecutorService.class);
    final Supplier<SuspendController> scSupplier = !processType.isHostController() ? builder.requiresCapability("org.wildfly.server.suspend-controller", SuspendController.class) : null;
    builder.setInstance(new ProcessStateListenerService(processType, runningMode, listenerName, listener, properties, timeout, psnSupplier, scSupplier, esSupplier));
    builder.install();
}
 
Example 4
Source File: ProcessStateListenerService.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private ProcessStateListenerService(ProcessType processType, RunningMode runningMode, String name, ProcessStateListener listener, Map<String, String> properties, int timeout,
                                    final Supplier<ProcessStateNotifier> processStateNotifierSupplier,
                                    final Supplier<SuspendController> suspendControllerSupplier,
                                    final Supplier<ExecutorService> executorServiceSupplier
) {
    CoreManagementLogger.ROOT_LOGGER.debugf("Initalizing ProcessStateListenerService with a running mode of %s", runningMode);
    this.listener = listener;
    this.name = name;
    this.timeout = timeout;
    this.processType = processType;
    this.parameters = new ProcessStateListenerInitParameters.Builder()
            .setInitProperties(properties)
            .setRunningMode(Process.RunningMode.from(runningMode.name()))
            .setProcessType(Process.Type.valueOf(processType.name()))
            .build();
    this.propertyChangeListener = (PropertyChangeEvent evt) -> {
        if ("currentState".equals(evt.getPropertyName())) {
            Process.RuntimeConfigurationState oldState = Process.RuntimeConfigurationState.valueOf(((ControlledProcessState.State) evt.getOldValue()).name());
            Process.RuntimeConfigurationState newState = Process.RuntimeConfigurationState.valueOf(((ControlledProcessState.State) evt.getNewValue()).name());
            transition(oldState, newState);
        }
    };
    this.processStateNotifierSupplier = processStateNotifierSupplier;
    this.suspendControllerSupplier = suspendControllerSupplier;
    this.executorServiceSupplier = executorServiceSupplier;
    if (!processType.isHostController()) {
        this.operationListener = new OperationListener() {
            @Override
            public void suspendStarted() {
                suspendTransition(runningState, Process.RunningState.SUSPENDING);
            }

            @Override
            public void complete() {
                suspendTransition(runningState, Process.RunningState.SUSPENDED);
            }

            @Override
            public void cancelled() {
                if(runningState == null || runningState == Process.RunningState.STARTING) {//gracefull startup
                     suspendTransition(Process.RunningState.STARTING, Process.RunningState.SUSPENDED);
                }
                switch (runningMode) {
                    case ADMIN_ONLY:
                        suspendTransition(runningState, Process.RunningState.ADMIN_ONLY);
                        break;
                    case NORMAL:
                        suspendTransition(runningState, Process.RunningState.NORMAL);
                        break;
                }
            }

            @Override
            public void timeout() {
            }
        };
    } else {
        operationListener = null;
    }
}