Class ChannelFactory
- java.lang.Object
-
- org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory
-
@ThreadSafe public class ChannelFactory extends Object
Central component providing connections to remote server. Most of the code originates in TcpTransportFactory.- Since:
- 9.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChannelFactory.ClusterSwitchStatus
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_CLUSTER_NAME
-
Constructor Summary
Constructors Constructor Description ChannelFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicIntegercreateTopologyId(byte[] cacheName)voiddestroy()<T extends ChannelOperation>
TfetchChannelAndInvoke(Object key, Set<SocketAddress> failedServers, byte[] cacheName, T operation)<T extends ChannelOperation>
TfetchChannelAndInvoke(SocketAddress server, T operation)<T extends ChannelOperation>
TfetchChannelAndInvoke(Set<SocketAddress> failedServers, byte[] cacheName, T operation)FailoverRequestBalancingStrategygetBalancer(byte[] cacheName)Note that the returnedRequestBalancingStrategymay not be thread-safe.CacheTopologyInfogetCacheTopologyInfo(byte[] cacheName)ConfigurationgetConfiguration()ConsistentHashgetConsistentHash(byte[] cacheName)Note that the returnedConsistentHashmay not be thread-safe.ConsistentHashFactorygetConsistentHashFactory()StringgetCurrentClusterName()org.infinispan.commons.marshall.MarshallergetMarshaller()MarshallerRegistrygetMarshallerRegistry()intgetMaxRetries()intgetNumActive()intgetNumActive(SocketAddress address)intgetNumIdle()intgetNumIdle(SocketAddress address)Map<SocketAddress,Set<Integer>>getPrimarySegmentsByAddress(byte[] cacheName)longgetRetries()Collection<SocketAddress>getServers()SocketAddressgetSocketAddress(Object key, byte[] cacheName)intgetTopologyAge()intgetTopologyId(byte[] cacheName)voidincrementRetryCount()booleanisTcpKeepAlive()booleanisTcpNoDelay()voidreleaseChannel(io.netty.channel.Channel channel)voidreset(byte[] cacheName)intsocketTimeout()voidstart(Codec codec, Configuration configuration, AtomicInteger defaultCacheTopologyId, org.infinispan.commons.marshall.Marshaller marshaller, ExecutorService executorService, ClientListenerNotifier listenerNotifier, Collection<Consumer<Set<SocketAddress>>> failedServerNotifier, MarshallerRegistry marshallerRegistry)booleanswitchToCluster(String clusterName)CompletableFuture<ChannelFactory.ClusterSwitchStatus>trySwitchCluster(String failedClusterName, byte[] cacheName)voidupdateHashFunction(SocketAddress[][] segmentOwners, int numSegments, short hashFunctionVersion, byte[] cacheName, AtomicInteger topologyId)voidupdateHashFunction(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace, byte[] cacheName, AtomicInteger topologyId)voidupdateServers(Collection<SocketAddress> newServers, byte[] cacheName, boolean quiet)protected Collection<SocketAddress>updateTopologyInfo(byte[] cacheName, Collection<SocketAddress> newServers, boolean quiet)
-
-
-
Field Detail
-
DEFAULT_CLUSTER_NAME
public static final String DEFAULT_CLUSTER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public void start(Codec codec, Configuration configuration, AtomicInteger defaultCacheTopologyId, org.infinispan.commons.marshall.Marshaller marshaller, ExecutorService executorService, ClientListenerNotifier listenerNotifier, Collection<Consumer<Set<SocketAddress>>> failedServerNotifier, MarshallerRegistry marshallerRegistry)
-
getMarshallerRegistry
public MarshallerRegistry getMarshallerRegistry()
-
destroy
public void destroy()
-
getCacheTopologyInfo
public CacheTopologyInfo getCacheTopologyInfo(byte[] cacheName)
-
getPrimarySegmentsByAddress
public Map<SocketAddress,Set<Integer>> getPrimarySegmentsByAddress(byte[] cacheName)
-
updateHashFunction
public void updateHashFunction(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace, byte[] cacheName, AtomicInteger topologyId)
-
updateHashFunction
public void updateHashFunction(SocketAddress[][] segmentOwners, int numSegments, short hashFunctionVersion, byte[] cacheName, AtomicInteger topologyId)
-
fetchChannelAndInvoke
public <T extends ChannelOperation> T fetchChannelAndInvoke(Set<SocketAddress> failedServers, byte[] cacheName, T operation)
-
fetchChannelAndInvoke
public <T extends ChannelOperation> T fetchChannelAndInvoke(SocketAddress server, T operation)
-
getSocketAddress
public SocketAddress getSocketAddress(Object key, byte[] cacheName)
-
fetchChannelAndInvoke
public <T extends ChannelOperation> T fetchChannelAndInvoke(Object key, Set<SocketAddress> failedServers, byte[] cacheName, T operation)
-
releaseChannel
public void releaseChannel(io.netty.channel.Channel channel)
-
updateServers
public void updateServers(Collection<SocketAddress> newServers, byte[] cacheName, boolean quiet)
-
updateTopologyInfo
protected Collection<SocketAddress> updateTopologyInfo(byte[] cacheName, Collection<SocketAddress> newServers, boolean quiet)
-
getServers
public Collection<SocketAddress> getServers()
-
getConsistentHash
public ConsistentHash getConsistentHash(byte[] cacheName)
Note that the returnedConsistentHashmay not be thread-safe.
-
getConsistentHashFactory
public ConsistentHashFactory getConsistentHashFactory()
-
isTcpNoDelay
public boolean isTcpNoDelay()
-
isTcpKeepAlive
public boolean isTcpKeepAlive()
-
getMaxRetries
public int getMaxRetries()
-
reset
public void reset(byte[] cacheName)
-
createTopologyId
public AtomicInteger createTopologyId(byte[] cacheName)
-
getTopologyId
public int getTopologyId(byte[] cacheName)
-
trySwitchCluster
public CompletableFuture<ChannelFactory.ClusterSwitchStatus> trySwitchCluster(String failedClusterName, byte[] cacheName)
-
getMarshaller
public org.infinispan.commons.marshall.Marshaller getMarshaller()
-
switchToCluster
public boolean switchToCluster(String clusterName)
-
getCurrentClusterName
public String getCurrentClusterName()
-
getTopologyAge
public int getTopologyAge()
-
getBalancer
public FailoverRequestBalancingStrategy getBalancer(byte[] cacheName)
Note that the returnedRequestBalancingStrategymay not be thread-safe.
-
socketTimeout
public int socketTimeout()
-
getNumActive
public int getNumActive(SocketAddress address)
-
getNumIdle
public int getNumIdle(SocketAddress address)
-
getNumActive
public int getNumActive()
-
getNumIdle
public int getNumIdle()
-
getConfiguration
public Configuration getConfiguration()
-
getRetries
public long getRetries()
-
incrementRetryCount
public void incrementRetryCount()
-
-