本文整理汇总了Java中org.jboss.msc.service.ServiceContainer.getService方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContainer.getService方法的具体用法?Java ServiceContainer.getService怎么用?Java ServiceContainer.getService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.msc.service.ServiceContainer
的用法示例。
在下文中一共展示了ServiceContainer.getService方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGet
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
ServiceContainer sc = CurrentServiceContainer.getServiceContainer();
// for(ServiceName sn: sc.getServiceNames()) {
// log.info("" + sn);
// }
ServiceName sn = ServiceName.of("jboss", "infinispan", "web", "repl");
ServiceController scon = sc.getService(sn);
Cache cache = (Cache)scon.getValue();
log.info("" + cache);
String path = req.getPathInfo();
Object o = null;
if ("/put".equals(path)) {
cache.put("test", "blah");
}
else if ("/get".equals(path)) {
o = cache.get("test");
}
res.setContentType("text/html");
PrintWriter out = res.getWriter();
if (o != null) {
out.println(o);
}
}
示例2: findAllMissingServices
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
private static Set<ServiceName> findAllMissingServices(ServiceContainer container) {
Set<ServiceName> result = new HashSet<ServiceName>();
for (ServiceName serviceName : container.getServiceNames()) {
ServiceController<?> controller = container.getService(serviceName);
if (controller != null && controller.getMode() != ServiceController.Mode.NEVER && controller.getMode() != ServiceController.Mode.REMOVE
&& controller.getSubstate() == ServiceController.Substate.PROBLEM) {
result.addAll(controller.getImmediateUnavailableDependencies());
}
}
return result;
}
示例3: testInstallSubsystemXmlPlatformPlugins
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemXmlPlatformPlugins() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
ServiceController<BpmPlatformPlugins> serviceController = (ServiceController<BpmPlatformPlugins>) container.getService(ServiceNames.forBpmPlatformPlugins());
assertNotNull(serviceController);
BpmPlatformPlugins platformPlugins = serviceController.getValue();
assertNotNull(platformPlugins);
assertEquals(1, platformPlugins.getPlugins().size());
assertTrue(platformPlugins.getPlugins().get(0) instanceof ExampleBpmPlatformPlugin);
}
示例4: testInstallSubsystemXmlPlatformPlugins
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemXmlPlatformPlugins() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
ServiceController<BpmPlatformPlugins> serviceController = (ServiceController<BpmPlatformPlugins>) container.getService(PLATFORM_BPM_PLATFORM_PLUGINS_SERVICE_NAME);
assertNotNull(serviceController);
BpmPlatformPlugins platformPlugins = serviceController.getValue();
assertNotNull(platformPlugins);
assertEquals(1, platformPlugins.getPlugins().size());
assertTrue(platformPlugins.getPlugins().get(0) instanceof ExampleBpmPlatformPlugin);
}
示例5: addVDBFinishedService
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的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());
}
示例6: getWebServer
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
private static WebServer getWebServer() {
WebServer result = null;
ServiceName service = ServiceName.JBOSS.append("web");
ServiceContainer container = CurrentServiceContainer.getServiceContainer();
ServiceController<?> controller = container.getService(service);
if (controller == null) {
LOGGER.log(Level.SEVERE, "The service controller is null!");
} else {
result = (WebServer) controller.getService();
}
return result;
}
示例7: testInstallSubsystemWithEnginesAndPropertiesXml
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemWithEnginesAndPropertiesXml() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_AND_PROPERTIES);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));
ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
Map<String, String> configurationProperties = metadata.getConfigurationProperties();
assertEquals("default", configurationProperties.get("job-name"));
assertEquals("default", configurationProperties.get("job-acquisition"));
assertEquals("default", configurationProperties.get("job-acquisition-name"));
Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
assertTrue(foxLegacyProperties.isEmpty());
assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));
assertNotNull("process engine controller for engine __emptyPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__emptyPropertiesTag")));
assertNotNull("process engine controller for engine __noPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__noPropertiesTag")));
}
示例8: testInstallSubsystemWithEnginesAndPropertiesXml
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemWithEnginesAndPropertiesXml() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_AND_PROPERTIES);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
assertNotNull("process engine service should be bound in JNDI", container.getService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));
ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
Map<String, String> configurationProperties = metadata.getConfigurationProperties();
assertEquals("default", configurationProperties.get("job-name"));
assertEquals("default", configurationProperties.get("job-acquisition"));
assertEquals("default", configurationProperties.get("job-acquisition-name"));
Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
assertTrue(foxLegacyProperties.isEmpty());
assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));
assertNotNull("process engine controller for engine __emptyPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__emptyPropertiesTag")));
assertNotNull("process engine controller for engine __noPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__noPropertiesTag")));
}
示例9: deleteMember
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Override
public void deleteMember(RequestContext ctx, String id, Responder responder) {
if (id.equals("module")) {
responder.deleteNotSupported(registry.get(id));
return;
}
Resource resource = registry.get(id);
if (resource == null) {
responder.noSuchResource(id);
} else {
registry.remove(id);
if (configurationManager != null) {
try {
configurationManager.removeResource(id);
} catch (Exception e) {
e.printStackTrace();
}
}
ServiceController serviceController = serviceControllers.get(id);
if (serviceController != null && serviceController.getServiceContainer() != null) {
//TODO: figure out a better way to handle this......
ServiceContainer serviceContainer = serviceController.getServiceContainer();
ServiceName service = Services.instanceResource(id(), id);
if (serviceContainer.getService(service) != null) {
serviceContainer.getService(Services.instanceResource(id(), id)).setMode(ServiceController.Mode.REMOVE);
serviceContainer.getService(Services.instanceResource(id(), id).append("wrapper")).setMode(ServiceController.Mode.REMOVE);
serviceContainer.getService(Services.instanceResource(id(), id).append("apply-config")).setMode(ServiceController.Mode.REMOVE);
serviceContainer.getService(Services.instanceResource(id(), id).append("lifecycle")).setMode(ServiceController.Mode.REMOVE);
}
serviceController.setMode(ServiceController.Mode.REMOVE);
serviceControllers.remove(id);
}
responder.resourceDeleted(resource);
}
}
示例10: testInstallSubsystemWithJobExecutorAndPropertiesXml
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemWithJobExecutorAndPropertiesXml() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR_AND_PROPERTIES);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));
assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));
// "default" job acquisition ///////////////////////////////////////////////////////////
ServiceController<?> defaultJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("default"));
assertNotNull("platform job acquisition service 'default' should be installed", defaultJobAcquisitionService);
Object value = defaultJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor defaultJobExecutor = (JobExecutor) value;
assertEquals(300000, defaultJobExecutor.getLockTimeInMillis());
assertEquals(5000, defaultJobExecutor.getWaitTimeInMillis());
assertEquals(3, defaultJobExecutor.getMaxJobsPerAcquisition());
// "anders" job acquisition /////////////////////////////////////////////////////////
ServiceController<?> andersJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("anders"));
assertNotNull("platform job acquisition service 'anders' should be installed", andersJobAcquisitionService);
value = andersJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor andersJobExecutor = (JobExecutor) value;
assertEquals(600000, andersJobExecutor.getLockTimeInMillis());
assertEquals(10000, andersJobExecutor.getWaitTimeInMillis());
assertEquals(5, andersJobExecutor.getMaxJobsPerAcquisition());
// "mixed" job acquisition /////////////////////////////////////////////////////////
ServiceController<?> mixedJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("mixed"));
assertNotNull("platform job acquisition service 'mixed' should be installed", mixedJobAcquisitionService);
value = mixedJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor mixedJobExecutor = (JobExecutor) value;
assertEquals(500000, mixedJobExecutor.getLockTimeInMillis());
// default values
assertEquals(5000, mixedJobExecutor.getWaitTimeInMillis());
assertEquals(3, mixedJobExecutor.getMaxJobsPerAcquisition());
}
示例11: testInstallSubsystemWithJobExecutorAndPropertiesXml
import org.jboss.msc.service.ServiceContainer; //导入方法依赖的package包/类
@Test
public void testInstallSubsystemWithJobExecutorAndPropertiesXml() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR_AND_PROPERTIES);
KernelServices services = createKernelServicesBuilder(null)
.setSubsystemXml(subsystemXml)
.build();
ServiceContainer container = services.getContainer();
commonSubsystemServicesAreInstalled(container);
// "default" job acquisition ///////////////////////////////////////////////////////////
ServiceController<?> defaultJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("default"));
assertNotNull("platform job acquisition service 'default' should be installed", defaultJobAcquisitionService);
Object value = defaultJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor defaultJobExecutor = (JobExecutor) value;
assertEquals(300000, defaultJobExecutor.getLockTimeInMillis());
assertEquals(5000, defaultJobExecutor.getWaitTimeInMillis());
assertEquals(3, defaultJobExecutor.getMaxJobsPerAcquisition());
// ServiceName: 'org.camunda.bpm.platform.job-executor.job-executor-tp'
ServiceController<ManagedQueueExecutorService> managedQueueExecutorServiceController = (ServiceController<ManagedQueueExecutorService>) container.getService(ServiceNames.forManagedThreadPool(SubsystemAttributeDefinitons.DEFAULT_JOB_EXECUTOR_THREADPOOL_NAME));
assertNotNull(managedQueueExecutorServiceController);
ManagedQueueExecutorService managedQueueExecutorService = managedQueueExecutorServiceController.getValue();
assertNotNull(managedQueueExecutorService);
assertEquals("Number of core threads is wrong", SubsystemAttributeDefinitons.DEFAULT_CORE_THREADS, managedQueueExecutorService.getCoreThreads());
assertEquals("Number of max threads is wrong", SubsystemAttributeDefinitons.DEFAULT_MAX_THREADS, managedQueueExecutorService.getMaxThreads());
assertEquals(SubsystemAttributeDefinitons.DEFAULT_KEEPALIVE_TIME, TimeUnit.NANOSECONDS.toSeconds(managedQueueExecutorService.getKeepAlive()));
assertEquals(false, managedQueueExecutorService.isBlocking());
assertEquals(SubsystemAttributeDefinitons.DEFAULT_ALLOW_CORE_TIMEOUT, managedQueueExecutorService.isAllowCoreTimeout());
ServiceController<ThreadFactoryService> threadFactoryService = (ServiceController<ThreadFactoryService>) container.getService(ServiceNames.forThreadFactoryService(SubsystemAttributeDefinitons.DEFAULT_JOB_EXECUTOR_THREADPOOL_NAME));
assertNotNull(threadFactoryService);
// "anders" job acquisition /////////////////////////////////////////////////////////
ServiceController<?> andersJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("anders"));
assertNotNull("platform job acquisition service 'anders' should be installed", andersJobAcquisitionService);
value = andersJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor andersJobExecutor = (JobExecutor) value;
assertEquals(600000, andersJobExecutor.getLockTimeInMillis());
assertEquals(10000, andersJobExecutor.getWaitTimeInMillis());
assertEquals(5, andersJobExecutor.getMaxJobsPerAcquisition());
// "mixed" job acquisition /////////////////////////////////////////////////////////
ServiceController<?> mixedJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("mixed"));
assertNotNull("platform job acquisition service 'mixed' should be installed", mixedJobAcquisitionService);
value = mixedJobAcquisitionService.getValue();
assertNotNull(value);
assertTrue(value instanceof JobExecutor);
JobExecutor mixedJobExecutor = (JobExecutor) value;
assertEquals(500000, mixedJobExecutor.getLockTimeInMillis());
// default values
assertEquals(5000, mixedJobExecutor.getWaitTimeInMillis());
assertEquals(3, mixedJobExecutor.getMaxJobsPerAcquisition());
}