use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheMetricExecutor method execute.
@Override
public ModelNode execute(OperationContext context, Metric<RemoteCacheClientStatisticsMXBean> metric) throws OperationFailedException {
ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.PARENT);
FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
return (executor != null) ? executor.execute(new MetricFunction<>(new RemoteCacheClientStatisticsFactory(context.getCurrentAddressValue()), metric)) : null;
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteClusterOperationExecutor method execute.
@Override
public ModelNode execute(OperationContext context, ModelNode op, Operation<Map.Entry<String, RemoteCacheManagerMXBean>> operation) throws OperationFailedException {
ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.PARENT);
FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
Function<RemoteCacheContainer, Map.Entry<String, RemoteCacheManagerMXBean>> mapper = new Function<RemoteCacheContainer, Map.Entry<String, RemoteCacheManagerMXBean>>() {
@Override
public Map.Entry<String, RemoteCacheManagerMXBean> apply(RemoteCacheContainer container) {
String cluster = context.getCurrentAddressValue();
return new AbstractMap.SimpleImmutableEntry<>(cluster, container);
}
};
return (executor != null) ? executor.execute(new OperationFunction<>(context, op, mapper, operation)) : null;
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheContainerServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = new AsyncServiceConfigurator(this.getServiceName()).build(target);
Consumer<RemoteCacheContainer> container = this.configuration.register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(container, this, this, this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheServiceConfigurator method get.
@Override
public RemoteCache<K, V> get() {
String templateName = (this.configurationName != null) ? this.configurationName : DefaultTemplate.DIST_SYNC.getTemplateName();
NearCacheMode mode = this.nearCacheFactory.getMode();
Consumer<RemoteCacheConfigurationBuilder> configurator = new Consumer<RemoteCacheConfigurationBuilder>() {
@Override
public void accept(RemoteCacheConfigurationBuilder builder) {
builder.forceReturnValues(false).nearCacheMode(mode).transactionMode(TransactionMode.NONE).templateName(templateName);
}
};
this.container.get().getConfiguration().addRemoteCache(this.cacheName, configurator);
RemoteCacheContainer container = this.container.get();
try (RemoteCacheContainer.NearCacheRegistration registration = (this.nearCacheFactory != null) ? container.registerNearCacheFactory(this.cacheName, this.nearCacheFactory) : null) {
RemoteCache<K, V> cache = container.getCache(this.cacheName);
cache.start();
return cache;
}
}
use of org.wildfly.clustering.infinispan.client.RemoteCacheContainer in project wildfly by wildfly.
the class RemoteCacheContainerMetricExecutor method execute.
@Override
public ModelNode execute(OperationContext context, Metric<RemoteCacheManagerMXBean> metric) throws OperationFailedException {
ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.DEFAULT);
FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
return (executor != null) ? executor.execute(new MetricFunction<>(Functions.identity(), metric)) : null;
}
Aggregations