use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheContainerResourceDefinition method register.
@SuppressWarnings("deprecation")
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(ListAttribute.class).addIgnoredAttributes(EnumSet.complementOf(EnumSet.of(DeprecatedAttribute.MODULE))).addAttributeTranslation(DeprecatedAttribute.MODULE, new ListAttributeTranslation(ListAttribute.MODULES)).addCapabilities(Capability.class).addRequiredChildren(ConnectionPoolResourceDefinition.PATH, ThreadPoolResourceDefinition.CLIENT.getPathElement(), SecurityResourceDefinition.PATH, RemoteTransactionResourceDefinition.PATH).addRequiredSingletonChildren(NoNearCacheResourceDefinition.PATH).setResourceTransformation(RemoteCacheContainerResource::new);
ServiceValueExecutorRegistry<RemoteCacheContainer> executors = new ServiceValueExecutorRegistry<>();
ResourceServiceHandler handler = new RemoteCacheContainerServiceHandler(this, executors);
new SimpleResourceRegistration(descriptor, handler).register(registration);
new ConnectionPoolResourceDefinition().register(registration);
new RemoteClusterResourceDefinition(this, executors).register(registration);
new SecurityResourceDefinition().register(registration);
new RemoteTransactionResourceDefinition().register(registration);
new InvalidationNearCacheResourceDefinition().register(registration);
new NoNearCacheResourceDefinition().register(registration);
ThreadPoolResourceDefinition.CLIENT.register(registration);
if (registration.isRuntimeOnlyRegistrationValid()) {
new MetricHandler<>(new RemoteCacheContainerMetricExecutor(executors), RemoteCacheContainerMetric.class).register(registration);
new RemoteCacheResourceDefinition(executors).register(registration);
}
return registration;
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class HotRodStore method start.
@Override
public CompletionStage<Void> start(InitializationContext context) {
this.blockingManager = context.getBlockingManager();
HotRodStoreConfiguration configuration = context.getConfiguration();
RemoteCacheContainer container = configuration.remoteCacheContainer();
String cacheConfiguration = configuration.cacheConfiguration();
String cacheName = context.getCache().getName();
this.batchSize = configuration.maxBatchSize();
this.marshaller = context.getPersistenceMarshaller();
this.entryFactory = context.getMarshallableEntryFactory();
String templateName = (cacheConfiguration != null) ? cacheConfiguration : DefaultTemplate.DIST_SYNC.getTemplateName();
Consumer<RemoteCacheConfigurationBuilder> configurator = new Consumer<RemoteCacheConfigurationBuilder>() {
@Override
public void accept(RemoteCacheConfigurationBuilder builder) {
builder.forceReturnValues(false).transactionMode(TransactionMode.NONE).nearCacheMode(NearCacheMode.DISABLED).templateName(templateName);
}
};
container.getConfiguration().addRemoteCache(cacheName, configurator);
Runnable task = new Runnable() {
@Override
public void run() {
try {
HotRodStore.this.setRemoteCache(container, cacheName);
} catch (HotRodClientException ex) {
throw new PersistenceException(ex);
}
}
};
return this.blockingManager.runBlocking(task, "hotrod-store-start");
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheOperationExecutor method execute.
@Override
public ModelNode execute(OperationContext context, ModelNode op, Operation<RemoteCacheClientStatisticsMXBean> operation) throws OperationFailedException {
ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.PARENT);
FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
return (executor != null) ? executor.execute(new OperationFunction<>(context, op, new RemoteCacheClientStatisticsFactory(context.getCurrentAddressValue()), operation)) : null;
}
Aggregations