Search in sources :

Example 1 with DefaultAccessTimeoutService

use of org.jboss.as.ejb3.component.DefaultAccessTimeoutService in project wildfly by wildfly.

the class DefaultSessionBeanAccessTimeoutWriteHandler method applyModelToRuntime.

private void applyModelToRuntime(OperationContext context, final ModelNode model) throws OperationFailedException {
    long timeout = attribute.resolveModelAttribute(context, model).asLong();
    final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
    ServiceController<DefaultAccessTimeoutService> controller = (ServiceController<DefaultAccessTimeoutService>) serviceRegistry.getService(serviceName);
    if (controller != null) {
        DefaultAccessTimeoutService service = controller.getValue();
        if (service != null) {
            service.setDefaultAccessTimeout(timeout);
        }
    }
}
Also used : ServiceController(org.jboss.msc.service.ServiceController) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DefaultAccessTimeoutService(org.jboss.as.ejb3.component.DefaultAccessTimeoutService)

Example 2 with DefaultAccessTimeoutService

use of org.jboss.as.ejb3.component.DefaultAccessTimeoutService in project wildfly by wildfly.

the class DefaultStatefulBeanAccessTimeoutWriteHandler method updateOrCreateDefaultStatefulBeanAccessTimeoutService.

void updateOrCreateDefaultStatefulBeanAccessTimeoutService(final OperationContext context, final ModelNode model) throws OperationFailedException {
    final long defaultAccessTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_STATEFUL_BEAN_ACCESS_TIMEOUT.resolveModelAttribute(context, model).asLong();
    final ServiceName serviceName = DefaultAccessTimeoutService.STATEFUL_SERVICE_NAME;
    final ServiceRegistry registry = context.getServiceRegistry(true);
    final ServiceController<?> sc = registry.getService(serviceName);
    if (sc != null) {
        final DefaultAccessTimeoutService defaultAccessTimeoutService = DefaultAccessTimeoutService.class.cast(sc.getValue());
        defaultAccessTimeoutService.setDefaultAccessTimeout(defaultAccessTimeout);
    } else {
        // create and install the service
        final DefaultAccessTimeoutService defaultAccessTimeoutService = new DefaultAccessTimeoutService(defaultAccessTimeout);
        final ServiceController<?> newService = context.getServiceTarget().addService(serviceName, defaultAccessTimeoutService).install();
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DefaultAccessTimeoutService(org.jboss.as.ejb3.component.DefaultAccessTimeoutService)

Example 3 with DefaultAccessTimeoutService

use of org.jboss.as.ejb3.component.DefaultAccessTimeoutService in project wildfly by wildfly.

the class DefaultSingletonBeanAccessTimeoutWriteHandler method updateOrCreateDefaultSingletonBeanAccessTimeoutService.

void updateOrCreateDefaultSingletonBeanAccessTimeoutService(final OperationContext context, final ModelNode model) throws OperationFailedException {
    final long defaultAccessTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_SINGLETON_BEAN_ACCESS_TIMEOUT.resolveModelAttribute(context, model).asLong();
    final ServiceName serviceName = DefaultAccessTimeoutService.SINGLETON_SERVICE_NAME;
    final ServiceRegistry registry = context.getServiceRegistry(true);
    final ServiceController<?> sc = registry.getService(serviceName);
    if (sc != null) {
        final DefaultAccessTimeoutService defaultAccessTimeoutService = DefaultAccessTimeoutService.class.cast(sc.getValue());
        defaultAccessTimeoutService.setDefaultAccessTimeout(defaultAccessTimeout);
    } else {
        // create and install the service
        final DefaultAccessTimeoutService defaultAccessTimeoutService = new DefaultAccessTimeoutService(defaultAccessTimeout);
        final ServiceController<?> newService = context.getServiceTarget().addService(serviceName, defaultAccessTimeoutService).install();
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DefaultAccessTimeoutService(org.jboss.as.ejb3.component.DefaultAccessTimeoutService)

Aggregations

DefaultAccessTimeoutService (org.jboss.as.ejb3.component.DefaultAccessTimeoutService)3 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)3 ServiceName (org.jboss.msc.service.ServiceName)2 ServiceController (org.jboss.msc.service.ServiceController)1