Class ChannelFactory
- java.lang.Object
-
- org.infinispan.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:
- 14.0
-
-
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 AtomicReference<ClientTopology>createTopologyId(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)ClientIntelligencegetClientIntelligence()HotRodConfigurationgetConfiguration()ConsistentHashgetConsistentHash(byte[] cacheName)Note that the returnedConsistentHashmay not be thread-safe.ConsistentHashFactorygetConsistentHashFactory()StringgetCurrentClusterName()SocketAddressgetHashAwareServer(Object key, byte[] cacheName)org.infinispan.commons.marshall.MarshallergetMarshaller()MarshallerRegistrygetMarshallerRegistry()intgetMaxRetries()intgetNumActive()intgetNumActive(SocketAddress address)intgetNumIdle()intgetNumIdle(SocketAddress address)Map<SocketAddress,Set<Integer>>getPrimarySegmentsByAddress(byte[] cacheName)longgetRetries()Collection<InetSocketAddress>getServers()Collection<InetSocketAddress>getServers(byte[] cacheName)intgetTopologyAge()intgetTopologyId(byte[] cacheName)voidincrementRetryCount()booleanisTcpKeepAlive()booleanisTcpNoDelay()booleanmanualSwitchToCluster(String clusterName)Switch to an alternate cluster (or from an alternate cluster back to the main cluster).voidonConnectionEvent(org.infinispan.hotrod.impl.transport.netty.ChannelPool pool, org.infinispan.hotrod.impl.transport.netty.ChannelPool.ChannelEventType type)voidreceiveTopology(byte[] cacheName, int responseTopologyAge, int responseTopologyId, InetSocketAddress[] addresses, SocketAddress[][] segmentOwners, short hashFunctionVersion)voidreleaseChannel(io.netty.channel.Channel channel)intsocketTimeout()voidstart(Codec codec, HotRodConfiguration configuration, org.infinispan.commons.marshall.Marshaller marshaller, ExecutorService executorService, ClientListenerNotifier listenerNotifier, MarshallerRegistry marshallerRegistry)protected voidupdateCacheInfo(org.infinispan.commons.marshall.WrappedBytes cacheName, CacheInfo newCacheInfo, 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, HotRodConfiguration configuration, org.infinispan.commons.marshall.Marshaller marshaller, ExecutorService executorService, ClientListenerNotifier listenerNotifier, 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)
-
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)
-
getHashAwareServer
public SocketAddress getHashAwareServer(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)
-
receiveTopology
public void receiveTopology(byte[] cacheName, int responseTopologyAge, int responseTopologyId, InetSocketAddress[] addresses, SocketAddress[][] segmentOwners, short hashFunctionVersion)
-
updateCacheInfo
protected void updateCacheInfo(org.infinispan.commons.marshall.WrappedBytes cacheName, CacheInfo newCacheInfo, boolean quiet)
-
getServers
public Collection<InetSocketAddress> getServers()
-
getServers
public Collection<InetSocketAddress> getServers(byte[] cacheName)
-
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()
-
createTopologyId
public AtomicReference<ClientTopology> createTopologyId(byte[] cacheName)
-
getTopologyId
public int getTopologyId(byte[] cacheName)
-
onConnectionEvent
public void onConnectionEvent(org.infinispan.hotrod.impl.transport.netty.ChannelPool pool, org.infinispan.hotrod.impl.transport.netty.ChannelPool.ChannelEventType type)
-
manualSwitchToCluster
public boolean manualSwitchToCluster(String clusterName)
Switch to an alternate cluster (or from an alternate cluster back to the main cluster).Overrides any automatic cluster switch in progress, which may be useful when the automatic switch takes too long.
-
getMarshaller
public org.infinispan.commons.marshall.Marshaller getMarshaller()
-
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 HotRodConfiguration getConfiguration()
-
getRetries
public long getRetries()
-
incrementRetryCount
public void incrementRetryCount()
-
getClientIntelligence
public ClientIntelligence getClientIntelligence()
-
-