本文整理汇总了Java中org.jboss.msc.service.ServiceController.setMode方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceController.setMode方法的具体用法?Java ServiceController.setMode怎么用?Java ServiceController.setMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.msc.service.ServiceController
的用法示例。
在下文中一共展示了ServiceController.setMode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
public void stop(StopContext context) {
ServiceController<?> switchSvc = context.getController().getServiceContainer().getService(TeiidServiceNames.vdbSwitchServiceName(vdb.getName(), vdb.getVersion()));
if (switchSvc != null) {
switchSvc.setMode(ServiceController.Mode.REMOVE);
}
// stop object replication
if (this.objectReplicatorInjector.getValue() != null) {
GlobalTableStore gts = vdb.getAttachment(GlobalTableStore.class);
this.objectReplicatorInjector.getValue().stop(gts);
}
getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
getVDBRepository().removeListener(this.vdbListener);
getVDBRepository().removeListener(this.restEasyListener);
final ServiceController<?> controller = context.getController().getServiceContainer().getService(TeiidServiceNames.vdbFinishedServiceName(vdb.getName(), vdb.getVersion()));
if (controller != null) {
controller.setMode(ServiceController.Mode.REMOVE);
}
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50026, this.vdb));
}
示例2: undeploy
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
public void undeploy(final DeploymentUnit context) {
if (!TeiidAttachments.isTranslator(context)) {
return;
}
VDBTranslatorMetaData metadata = context.getAttachment(TeiidAttachments.TRANSLATOR_METADATA);
if (metadata == null) {
return;
}
final ServiceRegistry registry = context.getServiceRegistry();
final ServiceName serviceName = TeiidServiceNames.translatorServiceName(metadata.getName());
final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
controller.setMode(Mode.REMOVE);
}
}
示例3: undeploy
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
public void undeploy(final DeploymentUnit deploymentUnit) {
final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry();
final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
for (final ResourceRoot childRoot : childRoots) {
if (!SubDeploymentMarker.isSubDeployment(childRoot)) {
continue;
}
final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName());
final ServiceController<?> serviceController = serviceRegistry.getService(serviceName);
if (serviceController != null) {
serviceController.setMode(ServiceController.Mode.REMOVE);
}
}
deploymentUnit.removeAttachment(Attachments.SUB_DEPLOYMENTS);
}
示例4: testRuntime
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testRuntime() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
.setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(String.valueOf(mainServices.getBootError()));
}
ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
workerServiceController.setMode(ServiceController.Mode.ACTIVE);
workerServiceController.awaitValue();
XnioWorker worker = workerServiceController.getService().getValue();
Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
ModelNode op = Util.createOperation("read-resource", addr);
op.get("include-runtime").set(true);
mainServices.executeOperation(op);
}
示例5: testRuntime
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testRuntime() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
.setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(mainServices.getBootError().toString());
}
ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
workerServiceController.setMode(ServiceController.Mode.ACTIVE);
workerServiceController.awaitValue();
XnioWorker worker = workerServiceController.getService().getValue();
Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
ModelNode op = Util.createOperation("read-resource", addr);
op.get("include-runtime").set(true);
mainServices.executeOperation(op);
}
示例6: addVDBFinishedService
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
private ServiceBuilder<Void> addVDBFinishedService(StartContext context) {
ServiceContainer serviceContainer = context.getController().getServiceContainer();
final ServiceController<?> controller = serviceContainer.getService(TeiidServiceNames.vdbFinishedServiceName(vdb.getName(), vdb.getVersion()));
if (controller != null) {
controller.setMode(ServiceController.Mode.REMOVE);
}
return serviceContainer.addService(TeiidServiceNames.vdbFinishedServiceName(vdb.getName(), vdb.getVersion()), createVoidService());
}
示例7: testRuntime
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testRuntime() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
.setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(mainServices.getBootError().toString());
}
ServiceController<RequestController> workerServiceController = (ServiceController<RequestController>) mainServices.getContainer().getService(RequestController.SERVICE_NAME);
workerServiceController.setMode(ServiceController.Mode.ACTIVE);
workerServiceController.awaitValue();
RequestController controller = workerServiceController.getService().getValue();
Assert.assertEquals(100, controller.getMaxRequestCount());
}
示例8: testRuntime
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
/**
* Tests that the outbound connections configured in the remoting subsytem are processed and services
* are created for them
*
* @throws Exception
*/
@Test
public void testRuntime() throws Exception {
KernelServices services = createKernelServicesBuilder(createRuntimeAdditionalInitialization())
.setSubsystemXml(getSubsystemXml())
.build();
ServiceController<Endpoint> endPointServiceController = (ServiceController<Endpoint>) services.getContainer().getRequiredService(RemotingServices.SUBSYSTEM_ENDPOINT);
endPointServiceController.setMode(ServiceController.Mode.ACTIVE);
Endpoint endpointService = endPointServiceController.getValue();
assertNotNull("Endpoint service was null", endpointService);
assertNotNull(endpointService.getName());
ServiceName connectorServiceName = RemotingServices.serverServiceName("remoting-connector");
ServiceController<?> remotingConnectorController = services.getContainer().getRequiredService(connectorServiceName);
remotingConnectorController.setMode(ServiceController.Mode.ACTIVE);
assertNotNull("Connector was null", remotingConnectorController);
InjectedSocketBindingStreamServerService remotingConnector = (InjectedSocketBindingStreamServerService) remotingConnectorController.getService();
assertEquals("remote", remotingConnector.getEndpointInjector().getValue().getName());
ServiceController<?> httpConnectorController = services.getContainer().getRequiredService(RemotingHttpUpgradeService.UPGRADE_SERVICE_NAME.append("http-connector"));
assertNotNull("Http connector was null", httpConnectorController);
httpConnectorController.setMode(ServiceController.Mode.ACTIVE);
InjectedSocketBindingStreamServerService httpConnector = (InjectedSocketBindingStreamServerService) remotingConnectorController.getService();
assertEquals("remote", httpConnector.getEndpointInjector().getValue().getName());
}
示例9: testClear
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testClear() throws OperationFailedException, InterruptedException {
add(RELOAD_ELEMENT);
try {
requireReload(RELOAD_ELEMENT);
runtimeCheck(false, RELOAD_ELEMENT);
runtimeOnlyCheck(true, RELOAD_ELEMENT);
// Do a mock reload
ServiceController<?> svc = container.getRequiredService(ServiceName.of("ModelController"));
final AtomicInteger downCaps = new AtomicInteger();
final AtomicInteger downPossibleCaps = new AtomicInteger();
StabilityMonitor monitor = new StabilityMonitor();
monitor.addController(svc);
svc.setMode(ServiceController.Mode.NEVER);
monitor.awaitStability();
downCaps.set(capabilityRegistry.getCapabilities().size());
downPossibleCaps.set(capabilityRegistry.getPossibleCapabilities().size());
svc.setMode(ServiceController.Mode.ACTIVE);
Assert.assertTrue("Failed to reload", monitor.awaitStability(30, TimeUnit.SECONDS));
Assert.assertEquals(0, downCaps.get());
Assert.assertEquals(0, downPossibleCaps.get());
Assert.assertEquals(expectedCaps(0), capabilityRegistry.getCapabilities().size());
Assert.assertEquals(expectedCaps(0), capabilityRegistry.getPossibleCapabilities().size());
runtimeCheck(true, RELOAD_ELEMENT);
runtimeOnlyCheck(true, RELOAD_ELEMENT);
} finally {
//noinspection ThrowFromFinallyBlock
remove(RELOAD_ELEMENT);
}
}
示例10: testRuntime
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testRuntime() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
.setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(mainServices.getBootError().toString());
}
ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
workerServiceController.setMode(ServiceController.Mode.ACTIVE);
workerServiceController.awaitValue();
XnioWorker worker = workerServiceController.getService().getValue();
Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
}
示例11: unadvertise
import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
public void unadvertise() {
for (ServiceController<?> controller : this.controllers) {
controller.setMode(ServiceController.Mode.REMOVE);
}
}