当前位置: 首页>>代码示例>>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;未经允许,请勿转载。