当前位置: 首页>>代码示例>>Java>>正文


Java ServiceController.getValue方法代码示例

本文整理汇总了Java中org.jboss.msc.service.ServiceController.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceController.getValue方法的具体用法?Java ServiceController.getValue怎么用?Java ServiceController.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.msc.service.ServiceController的用法示例。


在下文中一共展示了ServiceController.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doGet

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	String serviceName = getRequiredParameter(req, SERVICE);
	String expected = req.getParameter(EXPECTED);
	this.log(format("Received request for %s, expecting %s", serviceName, expected));
	@SuppressWarnings("unchecked")
	ServiceController<Environment> service = (ServiceController<Environment>) getServiceContainer()
			.getService(parse(serviceName));
	try {
		Environment env = service.getValue();
		if (expected != null) {
			for (int i = 0; i < RETRIES; ++i) {
				if ((env != null) && expected.equals(env.getNodeName()))
					break;
				Thread.yield();
				env = service.getValue();
			}
		}
		if (env != null) {
			resp.setHeader("node", env.getNodeName());
		}
	} catch (IllegalStateException e) {
		// Service was not started
	}
	resp.getWriter().write("Success");
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:27,代码来源:HAServiceServlet.java

示例2: doGet

import org.jboss.msc.service.ServiceController; //导入方法依赖的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);
        }
    }
 
开发者ID:NovaOrdis,项目名称:playground,代码行数:36,代码来源:AccessServlet.java

示例3: establishModelControllerClient

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
private synchronized void establishModelControllerClient(ControlledProcessState.State state, boolean storeState) {
    ModelControllerClient newClient = null;
    if (state != ControlledProcessState.State.STOPPING && state != ControlledProcessState.State.STOPPED && serviceContainer != null) {
        ModelControllerClientFactory clientFactory;
        try {
            @SuppressWarnings("unchecked")
            final ServiceController clientFactorySvc =
                    serviceContainer.getService(ServerService.JBOSS_SERVER_CLIENT_FACTORY);
            clientFactory = (ModelControllerClientFactory) clientFactorySvc.getValue();
        } catch (RuntimeException e) {
            // Either NPE because clientFactorySvc was not installed, or ISE from getValue because not UP
            clientFactory = null;
        }
        if (clientFactory != null) {
            newClient = clientFactory.createSuperUserClient(executorService, true);
        }
    }
    modelControllerClient = newClient;
    if (storeState || currentProcessState == null) {
        currentProcessState = state;
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:EmbeddedStandaloneServerFactory.java

示例4: testCannotRemoveDependentService

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testCannotRemoveDependentService() throws Exception {
    testAddPath();

    ServiceController<?> pathManagerService = getContainer().getRequiredService(PATH_MANAGER_SVC);
    PathManager pathManager = (PathManager) pathManagerService.getValue();

    PerformChangeCallback allCallback1 = new PerformChangeCallback(pathManager, "add2", Event.ADDED, Event.REMOVED, Event.UPDATED);
    PerformChangeCallback allCallback2 = new PerformChangeCallback(pathManager, "add2", Event.ADDED, Event.REMOVED, Event.UPDATED);

    checkServiceAndPathEntry("add1", "xyz", null);
    checkServiceAndPathEntry("add2", "123", "add1");

    ModelNode operation = createOperation(REMOVE);
    operation.get(OP_ADDR).add(PATH, "add1");
    executeForFailure(operation);

    allCallback1.checkDone();
    allCallback2.checkDone();

    checkServiceAndPathEntry("add1", "xyz", null);
    checkServiceAndPathEntry("add2", "123", "add1");
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:PathsTestCase.java

示例5: testBadAdd

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Test
public void testBadAdd() throws Exception {
    ServiceController<?> pathManagerService = getContainer().getRequiredService(PATH_MANAGER_SVC);
    PathManager pathManager = (PathManager) pathManagerService.getValue();

    PerformChangeCallback allCallback1 = new PerformChangeCallback(pathManager, "add1", Event.ADDED, Event.REMOVED, Event.UPDATED);

    ModelNode operation = createOperation(ADD);
    operation.get(OP_ADDR).add(PATH, "add1");
    operation.get(PATH).set("123");
    operation.get(RELATIVE_TO).set("bad");
    executeForFailure(operation);

    try {
        ServiceController<?> svc = getContainer().getRequiredService(AbstractPathService.pathNameOf("add1"));
        if (svc.getState() == State.UP) {
            Assert.fail("Should not managed to install service");
        }
    } catch (Exception expected) {
    }

    allCallback1.checkEvent(Event.ADDED, "add1", "123", "bad");
    allCallback1.checkEvent(Event.REMOVED, "add1", "123", "bad");
    allCallback1.checkDone();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:PathsTestCase.java

示例6: testPorts

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testPorts() throws Exception {
    ServiceController<SocketBinding> statusManagerService = (ServiceController<SocketBinding>) registry.getService(ServiceName.parse("org.wildfly.network.socket-binding.txn-status-manager"));
    SocketBinding statusManager = statusManagerService.getValue();
    assertEquals(9876, statusManager.getAbsolutePort());

    ServiceController<SocketBinding> recoveryService = (ServiceController<SocketBinding>) registry.getService(ServiceName.parse("org.wildfly.network.socket-binding.txn-recovery-environment"));
    SocketBinding recovery = recoveryService.getValue();
    assertEquals(4567, recovery.getAbsolutePort());

}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:13,代码来源:TransactionsArquillianTest.java

示例7: getDefaultListener

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
/**
 * Get the JBoss container's DefaultConnector.
 * @return the DefaultConnector
 */
public static ListenerService getDefaultListener() {
    ServiceController<Server> service = (ServiceController<Server>)_registry.getService(UndertowService.SERVER.append(_server));
    if (service != null) {
        Server server = service.getValue();
        for (ListenerService<?> listener : server.getListeners()) {
            if (listener.getName().equals(_listener)) {
                return listener;
            }
        }
    }
    return null;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:ServerUtil.java

示例8: getDefaultHostAliases

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
public static Set<String> getDefaultHostAliases() {
    ServiceController<Server> service = (ServiceController<Server>)_registry.getService(UndertowService.SERVER.append(_server));
    if (service != null) {
        Server server = service.getValue();
        for(Host host : server.getHosts()) {
            if (host.getName().equals(server.getDefaultHost())) {
                return host.getAllAliases();
            }
        }
    }
    return null;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:13,代码来源:ServerUtil.java

示例9: getSSLContext

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
/**
 * Get the {@link SSLContext} represented by this {@link Resource} or {@code null} if it is not currently available.
 *
 * @return The {@link SSLContext} represented by this {@link Resource} or {@code null} if it is not currently available.
 */
static SSLContext getSSLContext(ServiceController<SSLContext> sslContextServiceController) {
    if (sslContextServiceController == null || sslContextServiceController.getState() != State.UP) {
        return null;
    } else {
        return sslContextServiceController.getValue();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:SSLContextResource.java

示例10: getXnioWorker

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
static XnioWorker getXnioWorker(ServiceRegistry serviceRegistry, String name) {
    ServiceName serviceName = IO_WORKER_RUNTIME_CAPABILITY.getCapabilityServiceName(name, XnioWorker.class);
    ServiceController<XnioWorker> controller = (ServiceController<XnioWorker>) serviceRegistry.getService(serviceName);
    if (controller == null || controller.getState() != ServiceController.State.UP) {
        return null;
    }
    return controller.getValue();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:9,代码来源:WorkerResourceDefinition.java

示例11: getInstallationManager

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
protected InstallationManager getInstallationManager(OperationContext ctx) {
    final ServiceController<?> imController = ctx.getServiceRegistry(false).getRequiredService(InstallationManagerService.NAME);
    while (imController != null && imController.getState() == ServiceController.State.UP) {
        try {
            return (InstallationManager) imController.getValue();
        } catch (IllegalStateException e) {
            // ignore, caused by race from WFLY-3505
        }
    }
    return null;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:PatchStreamResourceOperationStepHandler.java

示例12: logAdminConsole

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
private void logAdminConsole() {
    ServiceController<?> controller = serviceContainer.getService(UndertowHttpManagementService.SERVICE_NAME);
    if (controller != null) {
        HttpManagement mgmt = (HttpManagement)controller.getValue();

        boolean hasHttp = mgmt.getHttpNetworkInterfaceBinding() != null;
        boolean hasHttps = mgmt.getHttpsNetworkInterfaceBinding() != null;
        if (hasHttp && hasHttps) {
            ServerLogger.AS_ROOT_LOGGER.logHttpAndHttpsManagement(NetworkUtils.formatIPAddressForURI(mgmt.getHttpNetworkInterfaceBinding().getAddress()), mgmt.getHttpPort(), NetworkUtils.formatIPAddressForURI(mgmt.getHttpsNetworkInterfaceBinding().getAddress()), mgmt.getHttpsPort());
            if (mgmt.hasConsole()) {
                ServerLogger.AS_ROOT_LOGGER.logHttpAndHttpsConsole(NetworkUtils.formatIPAddressForURI(mgmt.getHttpNetworkInterfaceBinding().getAddress()), mgmt.getHttpPort(), NetworkUtils.formatIPAddressForURI(mgmt.getHttpsNetworkInterfaceBinding().getAddress()), mgmt.getHttpsPort());
            } else {
                ServerLogger.AS_ROOT_LOGGER.logNoConsole();
            }
        } else if (hasHttp) {
            ServerLogger.AS_ROOT_LOGGER.logHttpManagement(NetworkUtils.formatIPAddressForURI(mgmt.getHttpNetworkInterfaceBinding().getAddress()), mgmt.getHttpPort());
            if (mgmt.hasConsole()) {
                ServerLogger.AS_ROOT_LOGGER.logHttpConsole(NetworkUtils.formatIPAddressForURI(mgmt.getHttpNetworkInterfaceBinding().getAddress()), mgmt.getHttpPort());
            } else {
                ServerLogger.AS_ROOT_LOGGER.logNoConsole();
            }
        } else if (hasHttps) {
            ServerLogger.AS_ROOT_LOGGER.logHttpsManagement(NetworkUtils.formatIPAddressForURI(mgmt.getHttpsNetworkInterfaceBinding().getAddress()), mgmt.getHttpsPort());
            if (mgmt.hasConsole()) {
                ServerLogger.AS_ROOT_LOGGER.logHttpsConsole(NetworkUtils.formatIPAddressForURI(mgmt.getHttpsNetworkInterfaceBinding().getAddress()), mgmt.getHttpsPort());
            } else {
                ServerLogger.AS_ROOT_LOGGER.logNoConsole();
            }
        } else {
            ServerLogger.AS_ROOT_LOGGER.logNoHttpManagement();
            ServerLogger.AS_ROOT_LOGGER.logNoConsole();
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:35,代码来源:BootstrapListener.java

示例13: createServer

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Before
public void createServer() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(new BaseAdditionalInitialization());
    String subsystemXml =
            "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" +
            "   <expose-resolved-model domain-name=\"jboss.as\" proper-property-format=\"false\"/>" +
            "   <expose-expression-model domain-name=\"jboss.as.expr\"/>" +
            "   <sensitivity non-core-mbeans=\"true\"/>" +
            "</subsystem>";
    builder.setSubsystemXml(subsystemXml);
    KernelServices services = builder.build();

    ServiceController<?> controller = services.getContainer().getRequiredService(MBeanServerService.SERVICE_NAME);
    server = (PluggableMBeanServer)controller.getValue();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:16,代码来源:PluggableMBeanServerTestCase.java

示例14: lookupSecurityRealm

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Before
public void lookupSecurityRealm() {
    ServiceContainer container = getContainer();
    ServiceController<?> service = container.getRequiredService(SecurityRealm.ServiceUtil.createServiceName(TEST_REALM));

    securityRealm = (SecurityRealm) service.getValue();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:8,代码来源:SecurityRealmTestBase.java

示例15: getAuthorizingCallbackHandler

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
private AuthorizingCallbackHandler getAuthorizingCallbackHandler(final String realmName) {
    SecurityRealm realm;
    if (TEST_REALM.equals(realmName)) {
        realm = securityRealm;
    } else {
        ServiceContainer container = getContainer();
        ServiceController<?> service = container.getRequiredService(SecurityRealm.ServiceUtil.createServiceName(realmName));

        realm = (SecurityRealm) service.getValue();
    }

    return realm.getAuthorizingCallbackHandler(AuthMechanism.PLAIN);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:14,代码来源:BaseLdapSuiteTest.java


注:本文中的org.jboss.msc.service.ServiceController.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。