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


Java ServiceController.awaitValue方法代码示例

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


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

示例1: executeRuntimeStep

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
@Override
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
    ServiceName credentialStoreServiceName = CREDENTIAL_STORE_UTIL.serviceName(operation);
    ServiceController<?> credentialStoreServiceController = context.getServiceRegistry(writeAccess).getRequiredService(credentialStoreServiceName);
    State serviceState;
    if ((serviceState = credentialStoreServiceController.getState()) != State.UP) {
        if (serviceMustBeUp) {
            try {
                // give it another chance to wait at most 500 mill-seconds
                credentialStoreServiceController.awaitValue(500, TimeUnit.MILLISECONDS);
            } catch (InterruptedException | IllegalStateException | TimeoutException e) {
                throw ROOT_LOGGER.requiredServiceNotUp(credentialStoreServiceName, credentialStoreServiceController.getState());
            }
        }
        serviceState = credentialStoreServiceController.getState();
        if (serviceState != State.UP) {
            if (serviceMustBeUp) {
                throw ROOT_LOGGER.requiredServiceNotUp(credentialStoreServiceName, serviceState);
            }
            return;
        }
    }
    CredentialStoreService service = (CredentialStoreService) credentialStoreServiceController.getService();
    performRuntime(context.getResult(), context, operation, service);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:CredentialStoreResourceDefinition.java

示例2: getModifiableSecurityRealm

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
/**
 * Try to obtain a {@link ModifiableSecurityRealm} based on the given {@link OperationContext}.
 *
 * @param context the current context
 * @return the current security realm
 * @throws OperationFailedException if any error occurs obtaining the reference to the security realm.
 */
static ModifiableSecurityRealm getModifiableSecurityRealm(OperationContext context) throws OperationFailedException {
    ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
    PathAddress currentAddress = context.getCurrentAddress();
    RuntimeCapability<Void> runtimeCapability = MODIFIABLE_SECURITY_REALM_RUNTIME_CAPABILITY.fromBaseCapability(currentAddress.getLastElement().getValue());
    ServiceName realmName = runtimeCapability.getCapabilityServiceName();
    ServiceController<ModifiableSecurityRealm> serviceController = getRequiredService(serviceRegistry, realmName, ModifiableSecurityRealm.class);
    if ( serviceController.getState() != ServiceController.State.UP ){
        try {
            serviceController.awaitValue(500, TimeUnit.MILLISECONDS);
        } catch (IllegalStateException | InterruptedException | TimeoutException e) {
            throw ROOT_LOGGER.requiredServiceNotUp(serviceController.getName(), serviceController.getState());
        }
    }
    return serviceController.getValue();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:ModifiableRealmDecorator.java

示例3: 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);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:IOSubsystemTestCase.java

示例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(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);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:IOSubsystem11TestCase.java

示例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<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());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:RequestControllerSubsystemTestCase.java

示例6: lookupService

import org.jboss.msc.service.ServiceController; //导入方法依赖的package包/类
protected LdapSearcherCache<?, K> lookupService(final OperationContext context, final ModelNode operation) throws OperationFailedException {
    String realmName = null;
    boolean forAuthentication = false;
    boolean forUserSearch = false;

    PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
    for (PathElement current : address) {
        String key = current.getKey();
        if (SECURITY_REALM.equals(key)) {
            realmName = current.getValue();
        } else if (AUTHENTICATION.equals(key)) {
            forAuthentication = true;
            forUserSearch = true;
        } else if (AUTHORIZATION .equals(key)) {
            forAuthentication = false;
        } else if (USERNAME_TO_DN.equals(key)) {
            forUserSearch = true;
        } else if (GROUP_SEARCH.equals(key)) {
            forUserSearch = false;
        }
    }
    ServiceName serviceName = LdapSearcherCache.ServiceUtil.createServiceName(forAuthentication, forUserSearch, realmName);

    ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceController<LdapSearcherCache<?, K>> service = (ServiceController<LdapSearcherCache<?, K>>) registry.getRequiredService(serviceName);

    try {
        return service.awaitValue();
    } catch (InterruptedException e) {
        throw new OperationFailedException(e);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:LdapCacheResourceDefinition.java

示例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<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());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:16,代码来源:IOSubsystem10TestCase.java


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