Search in sources :

Example 1 with TransportFactory

use of org.infinispan.client.hotrod.TransportFactory in project infinispan by infinispan.

the class ConfigurationBuilder method create.

@Override
public Configuration create() {
    List<ServerConfiguration> servers = new ArrayList<>();
    if (this.servers.size() > 0)
        for (ServerConfigurationBuilder server : this.servers) {
            servers.add(server.create());
        }
    else {
        servers.add(new ServerConfiguration("127.0.0.1", ConfigurationProperties.DEFAULT_HOTROD_PORT));
    }
    List<ClusterConfiguration> serverClusterConfigs = clusters.stream().map(ClusterConfigurationBuilder::create).collect(Collectors.toList());
    Marshaller buildMarshaller = this.marshaller;
    if (buildMarshaller == null && marshallerClass == null) {
        buildMarshaller = handleNullMarshaller();
    }
    Class<? extends Marshaller> buildMarshallerClass = this.marshallerClass;
    if (buildMarshallerClass == null) {
        // Populate the marshaller class as well, so it can be exported to properties
        buildMarshallerClass = buildMarshaller.getClass();
    } else {
        if (buildMarshaller != null && !buildMarshallerClass.isInstance(buildMarshaller))
            throw new IllegalArgumentException("Both marshaller and marshallerClass attributes are present, but marshaller is not an instance of marshallerClass");
    }
    Map<String, RemoteCacheConfiguration> remoteCaches = remoteCacheBuilders.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().create()));
    return new Configuration(asyncExecutorFactory.create(), balancingStrategyFactory, classLoader == null ? null : classLoader.get(), clientIntelligence, connectionPool.create(), connectionTimeout, consistentHashImpl, forceReturnValues, keySizeEstimate, buildMarshaller, buildMarshallerClass, protocolVersion, servers, socketTimeout, security.create(), tcpNoDelay, tcpKeepAlive, valueSizeEstimate, maxRetries, nearCache.create(), serverClusterConfigs, allowListRegExs, batchSize, transaction.create(), statistics.create(), features, contextInitializers, remoteCaches, transportFactory);
}
Also used : Arrays(java.util.Arrays) StringPropertyReplacer(org.infinispan.commons.util.StringPropertyReplacer) HotRodURI(org.infinispan.client.hotrod.impl.HotRodURI) Log(org.infinispan.client.hotrod.logging.Log) ConsistentHashV2(org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV2) HashMap(java.util.HashMap) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) HashSet(java.util.HashSet) LogFactory(org.infinispan.client.hotrod.logging.LogFactory) Matcher(java.util.regex.Matcher) SerializationContextInitializer(org.infinispan.protostream.SerializationContextInitializer) Map(java.util.Map) BiConsumer(java.util.function.BiConsumer) Features(org.infinispan.commons.util.Features) TypedProperties(org.infinispan.commons.util.TypedProperties) URI(java.net.URI) WeakReference(java.lang.ref.WeakReference) FailoverRequestBalancingStrategy(org.infinispan.client.hotrod.FailoverRequestBalancingStrategy) TransportFactory(org.infinispan.client.hotrod.TransportFactory) HOTROD(org.infinispan.client.hotrod.logging.Log.HOTROD) SegmentConsistentHash(org.infinispan.client.hotrod.impl.consistenthash.SegmentConsistentHash) Builder(org.infinispan.commons.configuration.Builder) Properties(java.util.Properties) ConfigurationProperties(org.infinispan.client.hotrod.impl.ConfigurationProperties) Util(org.infinispan.commons.util.Util) Set(java.util.Set) Collectors(java.util.stream.Collectors) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) ProtocolVersion(org.infinispan.client.hotrod.ProtocolVersion) ConsistentHash(org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash) Pattern(java.util.regex.Pattern) ProtoStreamMarshaller(org.infinispan.commons.marshall.ProtoStreamMarshaller) Collections(java.util.Collections) RoundRobinBalancingStrategy(org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy) Marshaller(org.infinispan.commons.marshall.Marshaller) ProtoStreamMarshaller(org.infinispan.commons.marshall.ProtoStreamMarshaller) Marshaller(org.infinispan.commons.marshall.Marshaller) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

WeakReference (java.lang.ref.WeakReference)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Set (java.util.Set)1 TimeUnit (java.util.concurrent.TimeUnit)1 BiConsumer (java.util.function.BiConsumer)1 Supplier (java.util.function.Supplier)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 FailoverRequestBalancingStrategy (org.infinispan.client.hotrod.FailoverRequestBalancingStrategy)1 ProtocolVersion (org.infinispan.client.hotrod.ProtocolVersion)1 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)1