Class ConfigurationBuilder
- java.lang.Object
-
- org.infinispan.client.hotrod.configuration.ConfigurationBuilder
-
- All Implemented Interfaces:
ConfigurationChildBuilder,Builder<Configuration>
public class ConfigurationBuilder extends Object implements ConfigurationChildBuilder, Builder<Configuration>
ConfigurationBuilder used to generate immutable
Configurationobjects to pass to theRemoteCacheManager(Configuration)constructor.If you prefer to configure the client declaratively, see
org.infinispan.client.hotrod.configuration- Since:
- 5.3
- Author:
- Tristan Tarrant
-
-
Constructor Summary
Constructors Constructor Description ConfigurationBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ClusterConfigurationBuilderaddCluster(String clusterName)Adds a new remote server clusterConfigurationBuilderaddContextInitializer(String contextInitializer)Supply aSerializationContextInitializerimplementation to register classes with theProtoStreamMarshaller'sSerializationContext.ConfigurationBuilderaddContextInitializer(org.infinispan.protostream.SerializationContextInitializer contextInitializer)Supply aSerializationContextInitializerimplementation to register classes with theProtoStreamMarshaller'sSerializationContext.ConfigurationBuilderaddContextInitializers(org.infinispan.protostream.SerializationContextInitializer... contextInitializers)Convenience method to supply multipleSerializationContextInitializerimplementations.ConfigurationBuilderaddJavaSerialWhiteList(String... regEx)List of regular expressions for classes that can be deserialized using standard Java deserialization when reading data that might have been stored with a different endpoint, e.g.ServerConfigurationBuilderaddServer()Adds a new remote serverConfigurationBuilderaddServers(String servers)Adds a list of remote servers in the form: host1[:port][;host2[:port]]...ExecutorFactoryConfigurationBuilderasyncExecutorFactory()Configuration for the executor service used for asynchronous work on the Transport, including asynchronous marshalling and Cache 'async operations' such as Cache.putAsync().ConfigurationBuilderbalancingStrategy(Class<? extends FailoverRequestBalancingStrategy> balancingStrategy)For replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.ConfigurationBuilderbalancingStrategy(String balancingStrategy)For replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.ConfigurationBuilderbalancingStrategy(Supplier<FailoverRequestBalancingStrategy> balancingStrategyFactory)For replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.ConfigurationBuilderbalancingStrategy(FailoverRequestBalancingStrategy balancingStrategy)Deprecated.ConfigurationBuilderbatchSize(int batchSize)Sets the batch size of internal iterators (ie.Configurationbuild()Builds a configuration objectConfigurationbuild(boolean validate)ConfigurationBuilderclassLoader(ClassLoader cl)Specifies theClassLoaderused to find certain resources used by configuration when specified by name (e.g.ConfigurationBuilderclientIntelligence(ClientIntelligence clientIntelligence)Specifies the level of "intelligence" the client should haveConnectionPoolConfigurationBuilderconnectionPool()Configures the connection poolConfigurationBuilderconnectionTimeout(int connectionTimeout)This property defines the maximum socket connect timeout in milliseconds before giving up connecting to the server.ConfigurationBuilderconsistentHashImpl(int version, Class<? extends org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash> consistentHashClass)Defines theConsistentHashimplementation to use for the specified version.ConfigurationBuilderconsistentHashImpl(int version, String consistentHashClass)Defines theConsistentHashimplementation to use for the specified version.Configurationcreate()Create the configuration beanConfigurationBuilderforceReturnValues(boolean forceReturnValues)Whether or not to implicitly FORCE_RETURN_VALUE for all calls.ConfigurationBuilderkeySizeEstimate(int keySizeEstimate)This hint allows sizing of byte buffers when serializing and deserializing keys, to minimize array resizing.ConfigurationBuildermarshaller(Class<? extends Marshaller> marshaller)Allows you to specify a customMarshallerimplementation to serialize and deserialize user objects.ConfigurationBuildermarshaller(String marshaller)Allows you to specify a customMarshallerimplementation to serialize and deserialize user objects.ConfigurationBuildermarshaller(Marshaller marshaller)Allows you to specify an instance ofMarshallerto serialize and deserialize user objects.ConfigurationBuildermaxRetries(int maxRetries)It sets the maximum number of retries for each request.NearCacheConfigurationBuildernearCache()Deprecated.since 11.0.static voidparseServers(String servers, BiConsumer<String,Integer> c)ConfigurationBuilderprotocolVersion(String protocolVersion)Deprecated.Useversion(ProtocolVersion)instead.ConfigurationBuilderread(Configuration template)Reads the configuration from an already created configuration bean into this builder.RemoteCacheConfigurationBuilderremoteCache(String name)Per-cache configurationSecurityConfigurationBuildersecurity()Security ConfigurationConfigurationBuildersocketTimeout(int socketTimeout)This property defines the maximum socket read timeout in milliseconds before giving up waiting for bytes from the server.StatisticsConfigurationBuilderstatistics()Configures client-side statistics.ConfigurationBuildertcpKeepAlive(boolean keepAlive)Affects TCP KEEPALIVE on the TCP stack.ConfigurationBuildertcpNoDelay(boolean tcpNoDelay)Affects TCP NODELAY on the TCP stack.TransactionConfigurationBuildertransaction()Transaction configurationvoidvalidate()Validate the data in this builder before building the configuration beanConfigurationBuildervalueSizeEstimate(int valueSizeEstimate)This hint allows sizing of byte buffers when serializing and deserializing values, to minimize array resizing.ConfigurationBuilderversion(ProtocolVersion protocolVersion)This property defines the protocol version that this client should use.ConfigurationBuilderwithProperties(Properties properties)Configures this builder using the specified properties.
-
-
-
Method Detail
-
addServer
public ServerConfigurationBuilder addServer()
Description copied from interface:ConfigurationChildBuilderAdds a new remote server- Specified by:
addServerin interfaceConfigurationChildBuilder
-
addCluster
public ClusterConfigurationBuilder addCluster(String clusterName)
Description copied from interface:ConfigurationChildBuilderAdds a new remote server cluster- Specified by:
addClusterin interfaceConfigurationChildBuilder
-
addServers
public ConfigurationBuilder addServers(String servers)
Description copied from interface:ConfigurationChildBuilderAdds a list of remote servers in the form: host1[:port][;host2[:port]]...- Specified by:
addServersin interfaceConfigurationChildBuilder
-
parseServers
public static final void parseServers(String servers, BiConsumer<String,Integer> c)
-
asyncExecutorFactory
public ExecutorFactoryConfigurationBuilder asyncExecutorFactory()
Description copied from interface:ConfigurationChildBuilderConfiguration for the executor service used for asynchronous work on the Transport, including asynchronous marshalling and Cache 'async operations' such as Cache.putAsync().- Specified by:
asyncExecutorFactoryin interfaceConfigurationChildBuilder
-
balancingStrategy
public ConfigurationBuilder balancingStrategy(String balancingStrategy)
Description copied from interface:ConfigurationChildBuilderFor replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.- Specified by:
balancingStrategyin interfaceConfigurationChildBuilder
-
balancingStrategy
@Deprecated public ConfigurationBuilder balancingStrategy(FailoverRequestBalancingStrategy balancingStrategy)
Deprecated.Description copied from interface:ConfigurationChildBuilderFor replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.- Specified by:
balancingStrategyin interfaceConfigurationChildBuilder
-
balancingStrategy
public ConfigurationBuilder balancingStrategy(Supplier<FailoverRequestBalancingStrategy> balancingStrategyFactory)
Description copied from interface:ConfigurationChildBuilderFor replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.- Specified by:
balancingStrategyin interfaceConfigurationChildBuilder
-
balancingStrategy
public ConfigurationBuilder balancingStrategy(Class<? extends FailoverRequestBalancingStrategy> balancingStrategy)
Description copied from interface:ConfigurationChildBuilderFor replicated (vs distributed) Hot Rod server clusters, the client balances requests to the servers according to this strategy.- Specified by:
balancingStrategyin interfaceConfigurationChildBuilder
-
classLoader
public ConfigurationBuilder classLoader(ClassLoader cl)
Description copied from interface:ConfigurationChildBuilderSpecifies theClassLoaderused to find certain resources used by configuration when specified by name (e.g. certificate stores). Infinispan will search through the classloader which loaded this class, the system classloader, the TCCL and the OSGi classloader (if applicable).- Specified by:
classLoaderin interfaceConfigurationChildBuilder
-
clientIntelligence
public ConfigurationBuilder clientIntelligence(ClientIntelligence clientIntelligence)
Description copied from interface:ConfigurationChildBuilderSpecifies the level of "intelligence" the client should have- Specified by:
clientIntelligencein interfaceConfigurationChildBuilder
-
connectionPool
public ConnectionPoolConfigurationBuilder connectionPool()
Description copied from interface:ConfigurationChildBuilderConfigures the connection pool- Specified by:
connectionPoolin interfaceConfigurationChildBuilder
-
connectionTimeout
public ConfigurationBuilder connectionTimeout(int connectionTimeout)
Description copied from interface:ConfigurationChildBuilderThis property defines the maximum socket connect timeout in milliseconds before giving up connecting to the server.- Specified by:
connectionTimeoutin interfaceConfigurationChildBuilder
-
consistentHashImpl
public ConfigurationBuilder consistentHashImpl(int version, Class<? extends org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash> consistentHashClass)
Description copied from interface:ConfigurationChildBuilderDefines theConsistentHashimplementation to use for the specified version. By default,ConsistentHashV2is used for version 1 andConsistentHashV2is used for version 2.- Specified by:
consistentHashImplin interfaceConfigurationChildBuilder
-
consistentHashImpl
public ConfigurationBuilder consistentHashImpl(int version, String consistentHashClass)
Description copied from interface:ConfigurationChildBuilderDefines theConsistentHashimplementation to use for the specified version. By default,ConsistentHashV2is used for version 1 andConsistentHashV2is used for version 2.- Specified by:
consistentHashImplin interfaceConfigurationChildBuilder
-
forceReturnValues
public ConfigurationBuilder forceReturnValues(boolean forceReturnValues)
Description copied from interface:ConfigurationChildBuilderWhether or not to implicitly FORCE_RETURN_VALUE for all calls.- Specified by:
forceReturnValuesin interfaceConfigurationChildBuilder
-
keySizeEstimate
public ConfigurationBuilder keySizeEstimate(int keySizeEstimate)
Description copied from interface:ConfigurationChildBuilderThis hint allows sizing of byte buffers when serializing and deserializing keys, to minimize array resizing. It defaults to 64.- Specified by:
keySizeEstimatein interfaceConfigurationChildBuilder
-
marshaller
public ConfigurationBuilder marshaller(String marshaller)
Description copied from interface:ConfigurationChildBuilderAllows you to specify a customMarshallerimplementation to serialize and deserialize user objects. This method is mutually exclusive withConfigurationChildBuilder.marshaller(Marshaller).- Specified by:
marshallerin interfaceConfigurationChildBuilder
-
marshaller
public ConfigurationBuilder marshaller(Class<? extends Marshaller> marshaller)
Description copied from interface:ConfigurationChildBuilderAllows you to specify a customMarshallerimplementation to serialize and deserialize user objects. This method is mutually exclusive withConfigurationChildBuilder.marshaller(Marshaller).- Specified by:
marshallerin interfaceConfigurationChildBuilder
-
marshaller
public ConfigurationBuilder marshaller(Marshaller marshaller)
Description copied from interface:ConfigurationChildBuilderAllows you to specify an instance ofMarshallerto serialize and deserialize user objects. This method is mutually exclusive withConfigurationChildBuilder.marshaller(Class).- Specified by:
marshallerin interfaceConfigurationChildBuilder
-
addContextInitializer
public ConfigurationBuilder addContextInitializer(String contextInitializer)
Description copied from interface:ConfigurationChildBuilderSupply aSerializationContextInitializerimplementation to register classes with theProtoStreamMarshaller'sSerializationContext.- Specified by:
addContextInitializerin interfaceConfigurationChildBuilder
-
addContextInitializer
public ConfigurationBuilder addContextInitializer(org.infinispan.protostream.SerializationContextInitializer contextInitializer)
Description copied from interface:ConfigurationChildBuilderSupply aSerializationContextInitializerimplementation to register classes with theProtoStreamMarshaller'sSerializationContext.- Specified by:
addContextInitializerin interfaceConfigurationChildBuilder
-
addContextInitializers
public ConfigurationBuilder addContextInitializers(org.infinispan.protostream.SerializationContextInitializer... contextInitializers)
Description copied from interface:ConfigurationChildBuilderConvenience method to supply multipleSerializationContextInitializerimplementations.- Specified by:
addContextInitializersin interfaceConfigurationChildBuilder
-
nearCache
@Deprecated public NearCacheConfigurationBuilder nearCache()
Deprecated.since 11.0. To be removed in 14.0. UseRemoteCacheConfigurationBuilder.nearCacheMode(NearCacheMode)andRemoteCacheConfigurationBuilder.nearCacheMaxEntries(int)instead.
-
protocolVersion
@Deprecated public ConfigurationBuilder protocolVersion(String protocolVersion)
Deprecated.Useversion(ProtocolVersion)instead.Description copied from interface:ConfigurationChildBuilderThis property defines the protocol version that this client should use. Defaults to the latest protocol version supported by this client.- Specified by:
protocolVersionin interfaceConfigurationChildBuilder
-
version
public ConfigurationBuilder version(ProtocolVersion protocolVersion)
Description copied from interface:ConfigurationChildBuilderThis property defines the protocol version that this client should use. Defaults to the latest protocol version supported by this client.- Specified by:
versionin interfaceConfigurationChildBuilder
-
security
public SecurityConfigurationBuilder security()
Description copied from interface:ConfigurationChildBuilderSecurity Configuration- Specified by:
securityin interfaceConfigurationChildBuilder
-
socketTimeout
public ConfigurationBuilder socketTimeout(int socketTimeout)
Description copied from interface:ConfigurationChildBuilderThis property defines the maximum socket read timeout in milliseconds before giving up waiting for bytes from the server. Defaults to 60000 (1 minute)- Specified by:
socketTimeoutin interfaceConfigurationChildBuilder
-
tcpNoDelay
public ConfigurationBuilder tcpNoDelay(boolean tcpNoDelay)
Description copied from interface:ConfigurationChildBuilderAffects TCP NODELAY on the TCP stack. Defaults to enabled- Specified by:
tcpNoDelayin interfaceConfigurationChildBuilder
-
tcpKeepAlive
public ConfigurationBuilder tcpKeepAlive(boolean keepAlive)
Description copied from interface:ConfigurationChildBuilderAffects TCP KEEPALIVE on the TCP stack. Defaults to disable- Specified by:
tcpKeepAlivein interfaceConfigurationChildBuilder
-
valueSizeEstimate
public ConfigurationBuilder valueSizeEstimate(int valueSizeEstimate)
Description copied from interface:ConfigurationChildBuilderThis hint allows sizing of byte buffers when serializing and deserializing values, to minimize array resizing. It defaults to 512- Specified by:
valueSizeEstimatein interfaceConfigurationChildBuilder
-
maxRetries
public ConfigurationBuilder maxRetries(int maxRetries)
Description copied from interface:ConfigurationChildBuilderIt sets the maximum number of retries for each request. A valid value should be greater or equals than 0 (zero). Zero means no retry will made in case of a network failure. It defaults to 10.- Specified by:
maxRetriesin interfaceConfigurationChildBuilder
-
addJavaSerialWhiteList
public ConfigurationBuilder addJavaSerialWhiteList(String... regEx)
Description copied from interface:ConfigurationChildBuilderList of regular expressions for classes that can be deserialized using standard Java deserialization when reading data that might have been stored with a different endpoint, e.g. REST.- Specified by:
addJavaSerialWhiteListin interfaceConfigurationChildBuilder
-
batchSize
public ConfigurationBuilder batchSize(int batchSize)
Description copied from interface:ConfigurationChildBuilderSets the batch size of internal iterators (ie.keySet().iterator(). Defaults to 10_000- Specified by:
batchSizein interfaceConfigurationChildBuilder- Parameters:
batchSize- the batch size to set- Returns:
- this configuration builder with the batch size set
-
statistics
public StatisticsConfigurationBuilder statistics()
Description copied from interface:ConfigurationChildBuilderConfigures client-side statistics.- Specified by:
statisticsin interfaceConfigurationChildBuilder
-
transaction
public TransactionConfigurationBuilder transaction()
Description copied from interface:ConfigurationChildBuilderTransaction configuration- Specified by:
transactionin interfaceConfigurationChildBuilder
-
remoteCache
public RemoteCacheConfigurationBuilder remoteCache(String name)
Description copied from interface:ConfigurationChildBuilderPer-cache configuration- Specified by:
remoteCachein interfaceConfigurationChildBuilder- Parameters:
name- the name of the cache to which specific configuration should be applied- Returns:
- the
RemoteCacheConfigurationBuilderfor the cache
-
withProperties
public ConfigurationBuilder withProperties(Properties properties)
Description copied from interface:ConfigurationChildBuilderConfigures this builder using the specified properties. SeeConfigurationBuilderfor a list.- Specified by:
withPropertiesin interfaceConfigurationChildBuilder
-
validate
public void validate()
Description copied from interface:BuilderValidate the data in this builder before building the configuration bean- Specified by:
validatein interfaceBuilder<Configuration>
-
create
public Configuration create()
Description copied from interface:BuilderCreate the configuration bean- Specified by:
createin interfaceBuilder<Configuration>- Returns:
-
build
public Configuration build()
Description copied from interface:ConfigurationChildBuilderBuilds a configuration object- Specified by:
buildin interfaceConfigurationChildBuilder
-
build
public Configuration build(boolean validate)
-
read
public ConfigurationBuilder read(Configuration template)
Description copied from interface:BuilderReads the configuration from an already created configuration bean into this builder. Returns an appropriate builder to allow fluent configuration- Specified by:
readin interfaceBuilder<Configuration>- Parameters:
template- the configuration from which to "clone" this config if needed.
-
-