Search in sources :

Example 1 with DistributableCacheFactoryBuilder

use of org.jboss.as.ejb3.cache.distributable.DistributableCacheFactoryBuilder in project wildfly by wildfly.

the class PassivationStoreWriteHandler method applyModelToRuntime.

private void applyModelToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode model) throws OperationFailedException {
    String name = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    ServiceName serviceName = DistributableCacheFactoryBuilderService.getServiceName(name);
    ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceController<?> service = registry.getService(serviceName);
    if (service != null) {
        DistributableCacheFactoryBuilder<?, ?> builder = (DistributableCacheFactoryBuilder<?, ?>) service.getValue();
        if (builder != null) {
            if (this.maxSizeAttribute.getName().equals(attributeName)) {
                int maxSize = this.maxSizeAttribute.resolveModelAttribute(context, model).asInt();
                builder.getConfiguration().setMaxSize(maxSize);
            }
        }
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DistributableCacheFactoryBuilder(org.jboss.as.ejb3.cache.distributable.DistributableCacheFactoryBuilder)

Aggregations

DistributableCacheFactoryBuilder (org.jboss.as.ejb3.cache.distributable.DistributableCacheFactoryBuilder)1 ServiceName (org.jboss.msc.service.ServiceName)1 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)1