當前位置: 首頁>>代碼示例>>Java>>正文


Java ControlledProcessStateService類代碼示例

本文整理匯總了Java中org.jboss.as.controller.ControlledProcessStateService的典型用法代碼示例。如果您正苦於以下問題:Java ControlledProcessStateService類的具體用法?Java ControlledProcessStateService怎麽用?Java ControlledProcessStateService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ControlledProcessStateService類屬於org.jboss.as.controller包,在下文中一共展示了ControlledProcessStateService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bootstrap

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
public FutureServiceContainer bootstrap() throws Exception {
    try {
        final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
        final ControlledProcessState processState = new ControlledProcessState(true);
        shutdownHook.setControlledProcessState(processState);
        ServiceTarget target = serviceContainer.subTarget();

        final ControlledProcessStateService controlledProcessStateService = ControlledProcessStateService.addService(target, processState).getValue();
        RunningStateJmx.registerMBean(controlledProcessStateService, null, runningModeControl, false);
        final HostControllerService hcs = new HostControllerService(environment, runningModeControl, authCode, processState, futureContainer);
        target.addService(HostControllerService.HC_SERVICE_NAME, hcs).install();
        return futureContainer;
    } catch (RuntimeException | Error e) {
        shutdownHook.run();
        throw e;
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:18,代碼來源:EmbeddedHostControllerBootstrap.java

示例2: activate

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
@Override
public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
    final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget();
    final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT;
    final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT;
    try {
        ManagementWorkerService.installService(serviceTarget);
        // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.SIMPLE
        @SuppressWarnings("deprecation")
        final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.SIMPLE, endpointConfig, DEFAULTS);
        ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options);

        // Install the communication services
        HostControllerConnectionService service = new HostControllerConnectionService(managementURI, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint, sslContextSupplier);
        Services.addServerExecutorDependency(serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service), service.getExecutorInjector())
                .addDependency(ServerService.JBOSS_SERVER_SCHEDULED_EXECUTOR, ScheduledExecutorService.class, service.getScheduledExecutorInjector())
                .addDependency(endpointName, Endpoint.class, service.getEndpointInjector())
                .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue())
                .setInitialMode(ServiceController.Mode.ACTIVE).install();

    } catch (OperationFailedException e) {
        throw new ServiceRegistryException(e);
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:25,代碼來源:DomainServerCommunicationServices.java

示例3: addService

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
/**
 * Add the deployment scanner service to a batch.
 *
 * @param context           context for the operation that is adding this service
 * @param resourceAddress   the address of the resource that manages the service
 * @param relativeTo        the relative to
 * @param path              the path
 * @param scanInterval      the scan interval
 * @param unit              the unit of {@code scanInterval}
 * @param autoDeployZip     whether zipped content should be auto-deployed
 * @param autoDeployExploded whether exploded content should be auto-deployed
 * @param autoDeployXml     whether xml content should be auto-deployed
 * @param scanEnabled       scan enabled
 * @param deploymentTimeout the deployment timeout
 * @param rollbackOnRuntimeFailure rollback on runtime failures
 * @param bootTimeService   the deployment scanner used in the boot time scan
 * @param scheduledExecutorService executor to use for asynchronous tasks
 * @return the controller for the deployment scanner service
 */
public static ServiceController<DeploymentScanner> addService(final OperationContext context, final PathAddress resourceAddress, final String relativeTo, final String path,
                                                              final int scanInterval, TimeUnit unit, final boolean autoDeployZip,
                                                              final boolean autoDeployExploded, final boolean autoDeployXml, final boolean scanEnabled, final long deploymentTimeout, boolean rollbackOnRuntimeFailure,
                                                              final FileSystemDeploymentService bootTimeService, final ScheduledExecutorService scheduledExecutorService) {
    final DeploymentScannerService service = new DeploymentScannerService(resourceAddress, relativeTo, path, scanInterval, unit, autoDeployZip,
            autoDeployExploded, autoDeployXml, scanEnabled, deploymentTimeout, rollbackOnRuntimeFailure, bootTimeService);
    final ServiceName serviceName = getServiceName(resourceAddress.getLastElement().getValue());

    return context.getServiceTarget().addService(serviceName, service)
            .addDependency(context.getCapabilityServiceName(PATH_MANAGER_CAPABILITY, PathManager.class), PathManager.class, service.pathManagerValue)
            .addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null),
                    NotificationHandlerRegistry.class, service.notificationRegistryValue)
            .addDependency(context.getCapabilityServiceName("org.wildfly.management.model-controller-client-factory", null),
                    ModelControllerClientFactory.class, service.clientFactoryValue)
            .addDependency(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_CHAINS)
            .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue)
            .addInjection(service.scheduledExecutorValue, scheduledExecutorService)
            .setInitialMode(Mode.ACTIVE)
            .install();
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:40,代碼來源:DeploymentScannerService.java

示例4: createService

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
public static ServiceController<RhqMetricsService> createService(final ServiceTarget target,
                                                                 final ServiceVerificationHandler verificationHandler,
                                                                 ModelNode config) {

    RhqMetricsService service = new RhqMetricsService(config);

    return target.addService(SERVICE_NAME, service)
            .addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class,
                    service.serverEnvironmentValue)
            .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class,
                    service.modelControllerValue)
            .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class,
                    service.processStateValue)
            .addListener(verificationHandler)
            .setInitialMode(ServiceController.Mode.ACTIVE)
            .install();
}
 
開發者ID:hawkular,項目名稱:wildfly-monitor,代碼行數:18,代碼來源:RhqMetricsService.java

示例5: start

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
@Override
public void start(final StartContext startContext) throws StartException {


    if (this.enabled) {


        // deferred startup: we have to wait until the server is running before we can monitor the subsystems (parallel service startup)
        ControlledProcessStateService stateService = processStateValue.getValue();
        serverStateListener = new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (ControlledProcessState.State.RUNNING.equals(evt.getNewValue())) {

                    MonitorLogger.LOGGER.infof("Starting monitoring subsystem");
                    startScheduler(startContext);
                }
            }
        };
        stateService.addPropertyChangeListener(serverStateListener);

    }

}
 
開發者ID:hawkular,項目名稱:wildfly-monitor,代碼行數:25,代碼來源:RhqMetricsService.java

示例6: bootstrap

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
/**
 * Start the host controller services.
 *
 * @throws Exception
 */
public void bootstrap() throws Exception {
    final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
    final ControlledProcessState processState = new ControlledProcessState(true);
    shutdownHook.setControlledProcessState(processState);
    ServiceTarget target = serviceContainer.subTarget();
    ControlledProcessStateService controlledProcessStateService = ControlledProcessStateService.addService(target, processState).getValue();
    RunningStateJmx.registerMBean(controlledProcessStateService, null, runningModeControl, false);
    final HostControllerService hcs = new HostControllerService(environment, runningModeControl, authCode, processState);
    target.addService(HostControllerService.HC_SERVICE_NAME, hcs).install();
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:16,代碼來源:HostControllerBootstrap.java

示例7: DomainApiCheckHandler

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
DomainApiCheckHandler(final ModelController modelController, final ControlledProcessStateService controlledProcessStateService, final Collection<String> allowedOrigins) {
    this.controlledProcessStateService = controlledProcessStateService;
    domainApiHandler = new EncodingHandler.Builder().build(Collections.<String,Object>emptyMap()).wrap(new DomainApiHandler(modelController));
    addContentHandler = new DomainApiUploadHandler(modelController);
    genericOperationHandler = new EncodingHandler.Builder().build(Collections.<String,Object>emptyMap()).wrap(new DomainApiGenericOperationHandler(modelController));
    if (allowedOrigins != null) {
        for (String allowedOrigin : allowedOrigins) {
            this.allowedOrigins.add(CorsUtil.sanitizeDefaultPort(allowedOrigin));
        }
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:12,代碼來源:DomainApiCheckHandler.java

示例8: ContentRepositoryCleaner

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
public ContentRepositoryCleaner(LocalModelControllerClient client, ControlledProcessStateService controlledProcessStateService,
                                ScheduledExecutorService scheduledExecutor, long interval, boolean server) {
    this.controlledProcessStateService = controlledProcessStateService;
    this.client = client;
    this.scheduledExecutor = scheduledExecutor;
    this.enabled = true;
    this.cleanInterval = interval;
    this.server = server;
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:10,代碼來源:ContentRepositoryCleaner.java

示例9: addService

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
public static void addService(final ServiceTarget serviceTarget, final ServiceName clientFactoryService, final ServiceName scheduledExecutorServiceName) {
    final ContentCleanerService service = new ContentCleanerService(true);
    ServiceBuilder<Void> builder = serviceTarget.addService(SERVICE_NAME, service)
            .addDependency(clientFactoryService, ModelControllerClientFactory.class, service.clientFactoryValue)
            .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue)
            .addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, service.scheduledExecutorValue);
    Services.addServerExecutorDependency(builder, service.executorServiceValue);
    builder.install();
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:10,代碼來源:ContentCleanerService.java

示例10: addServiceOnHostController

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
public static void addServiceOnHostController(final ServiceTarget serviceTarget, final ServiceName hostControllerServiceName, final ServiceName clientFactoryServiceName,
                                              final ServiceName hostControllerExecutorServiceName, final ServiceName scheduledExecutorServiceName) {
    final ContentCleanerService service = new ContentCleanerService(false);
    ServiceBuilder<Void> builder = serviceTarget.addService(SERVICE_NAME, service)
            .addDependency(clientFactoryServiceName, ModelControllerClientFactory.class, service.clientFactoryValue)
            .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue)
            .addDependency(hostControllerExecutorServiceName, ExecutorService.class, service.executorServiceValue)
            .addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, service.scheduledExecutorValue);
    builder.install();
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:11,代碼來源:ContentCleanerService.java

示例11: registerStateListener

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
private static void registerStateListener(RunningStateJmxMBean mbean, ControlledProcessStateService processStateService) {
    processStateService.addPropertyChangeListener((PropertyChangeEvent evt) -> {
        if ("currentState".equals(evt.getPropertyName())) {
            ControlledProcessState.State oldState = (ControlledProcessState.State) evt.getOldValue();
            ControlledProcessState.State newState = (ControlledProcessState.State) evt.getNewValue();
            mbean.setProcessState(oldState, newState);
        }
    });
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:10,代碼來源:RunningStateJmx.java

示例12: install

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
static void install(ServiceTarget serviceTarget, ProcessType processType, RunningMode runningMode, String listenerName, ProcessStateListener listener, Map<String, String> properties, int timeout) {
    ProcessStateListenerService service = new ProcessStateListenerService(processType, runningMode, listenerName, listener, properties, timeout);
    ServiceBuilder<Void> builder = serviceTarget.addService(SERVICE_NAME.append(listenerName), service)
            .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateService);
    if (!processType.isHostController()) {
        builder.addDependency(SuspendController.SERVICE_NAME, SuspendController.class, service.suspendControllerInjectedValue);
    }
    Services.addServerExecutorDependency(builder, service.executorServiceValue);
    builder.install();
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:11,代碼來源:ProcessStateListenerService.java

示例13: setControlledProcessStateService

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
void setControlledProcessStateService(ControlledProcessStateService state) {
	this.state = state;	
}
 
開發者ID:kenweezy,項目名稱:teiid,代碼行數:4,代碼來源:JBossLifeCycleListener.java

示例14: start

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
@Override
public void start() throws EmbeddedProcessStartException {
    EmbeddedHostControllerBootstrap hostControllerBootstrap = null;
    try {
        final long startTime = System.currentTimeMillis();
        // Take control of server use of System.exit
        SystemExiter.initialize(new SystemExiter.Exiter() {
            @Override
            public void exit(int status) {
                HostControllerImpl.this.exit();
            }
        });
        // Take control of stdio
        try {
            StdioContext.install();
            uninstallStdIo = true;
        } catch (IllegalStateException ignored) {
            // already installed
        }

        // Determine the ServerEnvironment
        HostControllerEnvironment environment = createHostControllerEnvironment(jbossHomeDir, cmdargs, startTime);

        FutureServiceContainer futureContainer = new FutureServiceContainer();
        final byte[] authBytes = new byte[ProcessController.AUTH_BYTES_LENGTH];
        new Random(new SecureRandom().nextLong()).nextBytes(authBytes);
        final String authCode = Base64.getEncoder().encodeToString(authBytes);
        hostControllerBootstrap = new EmbeddedHostControllerBootstrap(futureContainer, environment, authCode);
        hostControllerBootstrap.bootstrap();
        serviceContainer = futureContainer.get();
        executorService = Executors.newCachedThreadPool();
        @SuppressWarnings("unchecked")
        final Value<ControlledProcessStateService> processStateServiceValue = (Value<ControlledProcessStateService>) serviceContainer.getRequiredService(ControlledProcessStateService.SERVICE_NAME);
        controlledProcessStateService = processStateServiceValue.getValue();
        controlledProcessStateService.addPropertyChangeListener(processStateListener);
        establishModelControllerClient(controlledProcessStateService.getCurrentState(), false);
    } catch (RuntimeException rte) {
        if (hostControllerBootstrap != null) {
            hostControllerBootstrap.failed();
        }
        throw rte;
    } catch (Exception ex) {
        if (hostControllerBootstrap != null) {
            hostControllerBootstrap.failed();
        }
        throw EmbeddedLogger.ROOT_LOGGER.cannotStartEmbeddedServer(ex);
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:49,代碼來源:EmbeddedHostControllerFactory.java

示例15: start

import org.jboss.as.controller.ControlledProcessStateService; //導入依賴的package包/類
@Override
public void start() throws EmbeddedProcessStartException {

    Bootstrap bootstrap = null;
    try {
        final long startTime = System.currentTimeMillis();

        // Take control of server use of System.exit
        SystemExiter.initialize(new SystemExiter.Exiter() {
            @Override
            public void exit(int status) {
                StandaloneServerImpl.this.exit();
            }
        });

        // Take control of stdio
        try {
            StdioContext.install();
            uninstallStdIo = true;
        } catch (IllegalStateException ignored) {
            // already installed
        }

        // Determine the ServerEnvironment
        ServerEnvironment serverEnvironment = Main.determineEnvironment(cmdargs, systemProps, systemEnv, ServerEnvironment.LaunchType.EMBEDDED, startTime).getServerEnvironment();

        bootstrap = Bootstrap.Factory.newInstance();

        Bootstrap.Configuration configuration = new Bootstrap.Configuration(serverEnvironment);

        /*
         * This would setup an {@link TransientConfigurationPersister} which does not persist anything
         *
        final ExtensionRegistry extensionRegistry = configuration.getExtensionRegistry();
        final Bootstrap.ConfigurationPersisterFactory configurationPersisterFactory = new Bootstrap.ConfigurationPersisterFactory() {
            @Override
            public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) {
                final QName rootElement = new QName(Namespace.CURRENT.getUriString(), "server");
                final StandaloneXml parser = new StandaloneXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
                final File configurationFile = serverEnvironment.getServerConfigurationFile().getBootFile();
                XmlConfigurationPersister persister = new TransientConfigurationPersister(configurationFile, rootElement, parser, parser);
                for (Namespace namespace : Namespace.domainValues()) {
                    if (!namespace.equals(Namespace.CURRENT)) {
                        persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "server"), parser);
                    }
                }
                extensionRegistry.setWriterRegistry(persister);
                return persister;
            }
        };
        configuration.setConfigurationPersisterFactory(configurationPersisterFactory);
        */

        configuration.setModuleLoader(moduleLoader);

        Future<ServiceContainer> future = bootstrap.startup(configuration, Collections.<ServiceActivator>emptyList());

        serviceContainer = future.get();

        executorService = Executors.newCachedThreadPool();

        @SuppressWarnings("unchecked")
        final Value<ControlledProcessStateService> processStateServiceValue = (Value<ControlledProcessStateService>) serviceContainer.getRequiredService(ControlledProcessStateService.SERVICE_NAME);
        controlledProcessStateService = processStateServiceValue.getValue();
        controlledProcessStateService.addPropertyChangeListener(processStateListener);
        establishModelControllerClient(controlledProcessStateService.getCurrentState(), true);

    } catch (RuntimeException rte) {
        if (bootstrap != null) {
            bootstrap.failed();
        }
        throw rte;
    } catch (Exception ex) {
        if (bootstrap != null) {
            bootstrap.failed();
        }
        throw EmbeddedLogger.ROOT_LOGGER.cannotStartEmbeddedServer(ex);
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:80,代碼來源:EmbeddedStandaloneServerFactory.java


注:本文中的org.jboss.as.controller.ControlledProcessStateService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。