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 class
ChannelFactory.ClusterSwitchStatus
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CLUSTER_NAME
-
Constructor Summary
Constructors Constructor Description ChannelFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicInteger
createTopologyId(byte[] cacheName)
void
destroy()
<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)
FailoverRequestBalancingStrategy
getBalancer(byte[] cacheName)
Note that the returnedRequestBalancingStrategy
may not be thread-safe.CacheTopologyInfo
getCacheTopologyInfo(byte[] cacheName)
Configuration
getConfiguration()
ConsistentHash
getConsistentHash(byte[] cacheName)
Note that the returnedConsistentHash
may not be thread-safe.ConsistentHashFactory
getConsistentHashFactory()
String
getCurrentClusterName()
org.infinispan.commons.marshall.Marshaller
getMarshaller()
MarshallerRegistry
getMarshallerRegistry()
int
getMaxRetries()
int
getNumActive()
int
getNumActive(SocketAddress address)
int
getNumIdle()
int
getNumIdle(SocketAddress address)
Collection<SocketAddress>
getServers()
SocketAddress
getSocketAddress(Object key, byte[] cacheName)
int
getTopologyAge()
int
getTopologyId(byte[] cacheName)
boolean
isTcpKeepAlive()
boolean
isTcpNoDelay()
void
releaseChannel(io.netty.channel.Channel channel)
void
reset(byte[] cacheName)
int
socketTimeout()
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)
boolean
switchToCluster(String clusterName)
CompletableFuture<ChannelFactory.ClusterSwitchStatus>
trySwitchCluster(String failedClusterName, byte[] cacheName)
void
updateHashFunction(SocketAddress[][] segmentOwners, int numSegments, short hashFunctionVersion, byte[] cacheName, AtomicInteger topologyId)
void
updateHashFunction(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace, byte[] cacheName, AtomicInteger topologyId)
void
updateServers(Collection<SocketAddress> newServers, byte[] cacheName, 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)
-
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)
-
getServers
public Collection<SocketAddress> getServers()
-
getConsistentHash
public ConsistentHash getConsistentHash(byte[] cacheName)
Note that the returnedConsistentHash
may 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 returnedRequestBalancingStrategy
may 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()
-
-