use of org.infinispan.client.hotrod.configuration.ClusterConfigurationBuilder in project wildfly by wildfly.
the class RemoteCacheContainerConfigurationServiceConfigurator method get.
@Override
public Configuration get() {
String name = this.getServiceName().getSimpleName();
ConfigurationBuilder builder = new ConfigurationBuilder();
// Configure formal security first
builder.security().read(this.security.get());
// Apply properties next, which may override formal security configuration
builder.withProperties(this.properties).connectionTimeout(this.connectionTimeout).maxRetries(this.maxRetries).version(ProtocolVersion.parseVersion(this.protocolVersion)).socketTimeout(this.socketTimeout).statistics().enabled(this.statisticsEnabled).jmxDomain("org.wildfly.clustering.infinispan").jmxEnabled(this.server != null).jmxName(name).mBeanServerLookup((this.server != null) ? new MBeanServerProvider(this.server.get()) : null).tcpNoDelay(this.tcpNoDelay).tcpKeepAlive(this.tcpKeepAlive).transactionTimeout(this.transactionTimeout, TimeUnit.MILLISECONDS);
List<Module> modules = this.modules.get();
Marshaller marshaller = this.marshallerFactory.apply(this.loader.get(), modules);
builder.marshaller(marshaller);
builder.classLoader(modules.size() > 1 ? new AggregatedClassLoader(modules.stream().map(Module::getClassLoader).collect(Collectors.toList())) : modules.get(0).getClassLoader());
builder.connectionPool().read(this.connectionPool.get());
builder.asyncExecutorFactory().read(this.threadPools.get(ThreadPoolResourceDefinition.CLIENT).get());
for (Map.Entry<String, List<SupplierDependency<OutboundSocketBinding>>> cluster : this.clusters.entrySet()) {
String clusterName = cluster.getKey();
List<SupplierDependency<OutboundSocketBinding>> bindingDependencies = cluster.getValue();
if (this.defaultRemoteCluster.equals(clusterName)) {
for (Supplier<OutboundSocketBinding> bindingDependency : bindingDependencies) {
OutboundSocketBinding binding = bindingDependency.get();
builder.addServer().host(binding.getUnresolvedDestinationAddress()).port(binding.getDestinationPort());
}
} else {
ClusterConfigurationBuilder clusterConfigurationBuilder = builder.addCluster(clusterName);
for (Supplier<OutboundSocketBinding> bindingDependency : bindingDependencies) {
OutboundSocketBinding binding = bindingDependency.get();
clusterConfigurationBuilder.addClusterNode(binding.getUnresolvedDestinationAddress(), binding.getDestinationPort());
}
}
}
return builder.build();
}
Aggregations