Package org.jgroups.protocols
Class TP
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.TP
-
- All Implemented Interfaces:
Lifecycle,DiagnosticsHandler.ProbeHandler
- Direct Known Subclasses:
BasicTCP,MockTransport,SHARED_LOOPBACK,SimpleTCP,TUNNEL,UDP
public abstract class TP extends Protocol implements DiagnosticsHandler.ProbeHandler
Generic transport - specific implementations should extend this abstract class. Features which are provided to the subclasses include- version checking
- marshalling and unmarshalling
- message bundling (handling single messages, and message lists)
- incoming packet handler
sendUnicast(org.jgroups.PhysicalAddress, byte[], int, int)init()start(): subclasses must call super.start() after they initialize themselves (e.g., created their sockets).stop(): subclasses must call super.stop() after they deinitialized themselvesdestroy()
Thereceive(Address, byte[], int, int)method must be called by subclasses when a unicast or multicast message has been received.- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncExecutor<java.lang.Object>async_executorprotected java.net.InetAddressbind_addrprotected intbind_portThe port to which the transport binds.protected Bundlerbundlerprotected java.lang.Stringbundler_typeprotected AsciiStringcluster_nameThe name of the group to which this member is connected.protected java.util.concurrent.locks.ReentrantLockconnectLockprotected DiagnosticsHandlerdiag_handlerprotected java.net.InetAddressexternal_addrprotected intexternal_portprotected TpHeaderheaderThe header including the cluster name, sent with each messageprotected booleanis_traceprotected longlast_discovery_requeststatic byteLISTprotected PhysicalAddresslocal_physical_addrThe address (host and port) of this memberprotected LocalTransportlocal_transportprotected java.lang.Stringlocal_transport_classprotected booleanlog_discard_msgsWhether warnings about messages from different groups are logged - private flag, not for common useprotected booleanlog_discard_msgs_versionprotected LazyRemovalCache<Address,PhysicalAddress>logical_addr_cacheCache which maintains mappings between logical and physical addresses.protected longlogical_addr_cache_expirationprotected intlogical_addr_cache_max_sizeprotected java.util.concurrent.Future<?>logical_addr_cache_reaperprotected longlogical_addr_cache_reaper_intervalprotected java.util.Set<Address>membersThe members of this group (updated when a member joins or leaves).protected java.lang.Stringmessage_processing_policyprotected static longMIN_WAIT_BETWEEN_DISCOVERIESstatic intMSG_OVERHEADprotected MessageProcessingPolicymsg_processing_policyprotected MsgStatsmsg_statsstatic byteMULTICASTprotected intport_rangeprotected static LazyRemovalCache.Printable<Address,LazyRemovalCache.Entry<PhysicalAddress>>print_functionprotected java.util.List<java.net.NetworkInterface>receive_interfacesListof interfaces to receive multicasts on. protected booleanreceive_on_all_interfacesprotected RTTrttprotected SocketFactorysocket_factoryprotected SuppressLog<Address>suppress_log_different_clusterLog to suppress identical warnings for messages from members in different clustersprotected SuppressLog<Address>suppress_log_different_versionLog to suppress identical warnings for messages from members with different (incompatible) versionsprotected longsuppress_time_different_cluster_warningsprotected longsuppress_time_different_version_warningsprotected ThreadFactorythread_factoryFactory which is used by the thread poolprotected java.lang.Stringthread_naming_patternprotected ThreadPoolthread_poolThe thread pool which handles unmarshalling, version checks and dispatching of messagesprotected TimeServicetime_serviceprotected longtime_service_intervalprotected TimeSchedulertimerprotected booleantimer_handle_non_blocking_tasksprotected booleanuse_vthreadsprotected Viewviewprotected ExpiryCache<Address>who_has_cacheCache keeping track of WHO_HAS requests for physical addresses (given a logical address) and expiring them after who_has_cache_timeout msprotected longwho_has_cache_timeout-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTP()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr)protected booleanaddPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr, boolean overwrite)<T extends TP>
Tbundler(java.lang.String type)<T extends TP>
TclearDifferentClusterCache()<T extends TP>
TclearDifferentVersionCache()voidclearLogicalAddressCache()Clears the cache.static BundlercreateBundler(java.lang.String type, java.lang.Class<?> cl)protected DiagnosticsHandlercreateDiagnosticsHandler()java.lang.StringdefaultHeaders(boolean detailed)voiddestroy()This method is called on aJChannel.close().voiddisableDiagnostics()voiddoSend(byte[] buf, int offset, int length, Address dest)java.lang.Objectdown(Event evt)An event is to be sent down the stack.java.lang.Objectdown(Message msg)A message needs to be sent to a single member or all membersjava.lang.StringdumpTimerTasks()voidenableAllStats(boolean flag)<T extends TP>
TenableBlockingTimerTasks(boolean flag)<T extends TP>
TenableDiagnostics()voidenableStats(boolean flag)voidevictLogicalAddressCache()voidevictLogicalAddressCache(boolean force)protected voidfetchLocalAddresses()Grabs the local address (or addresses in the shared transport case) and registers them with the physical address in the transport's cacheprotected voidfetchPhysicalAddrs(java.util.List<Address> missing)protected ResponsesfetchResponsesFromDiscoveryProtocol(java.util.List<Address> missing)protected java.util.Collection<PhysicalAddress>getAllPhysicalAddressesFromCache()AsyncExecutor<java.lang.Object>getAsyncExecutor()java.net.InetAddressgetBindAddr()java.net.InetAddressgetBindAddress()intgetBindPort()BundlergetBundler()java.lang.StringgetBundlerClass()java.lang.StringgetBundlerType()java.lang.StringgetClusterName()AsciiStringgetClusterNameAscii()DiagnosticsHandlergetDiagnosticsHandler()intgetDifferentClusterMessages()intgetDifferentVersionMessages()java.net.InetAddressgetExternalAddr()intgetExternalPort()abstract java.lang.StringgetInfo()java.lang.StringgetLocalPhysicalAddress()LocalTransportgetLocalTransport()booleangetLogDiscardMessages()booleangetLogDiscardMessagesVersion()longgetLogicalAddrCacheExpiration()intgetLogicalAddrCacheMaxSize()longgetLogicalAddrCacheReaperInterval()LazyRemovalCache<Address,PhysicalAddress>getLogicalAddressCache()MessageProcessingPolicygetMessageProcessingPolicy()MsgStatsgetMessageStats()static longgetNumberOfThreadDumps()Deprecated.longgetNumMcastMsgsReceived()Deprecated.longgetNumMcastMsgsSent()Deprecated.longgetNumRejectedMsgs()Deprecated.static intgetNumThreads()intgetNumTimerTasks()longgetNumUcastMsgsReceived()Deprecated.longgetNumUcastMsgsSent()Deprecated.protected abstract PhysicalAddressgetPhysicalAddress()PhysicalAddressgetPhysicalAddressFromCache(Address logical_addr)intgetPortRange()java.util.List<java.net.NetworkInterface>getReceiveInterfaces()RTTgetRTT()SocketFactorygetSocketFactory()Returns the SocketFactory associated with this protocol, if overridden in a subclass, or passes the call downlonggetSuppressTimeDifferentClusterWarnings()longgetSuppressTimeDifferentVersionWarnings()ThreadFactorygetThreadFactory()Supposed to be overwritten by subclasses.java.lang.StringgetThreadNamingPattern()Names the current thread.ThreadPoolgetThreadPool()TimeSchedulergetTimer()java.lang.StringgetTimerClass()intgetTimerThreads()TimeServicegetTimeService()longgetTimeServiceInterval()longgetWhoHasCacheTimeout()protected voidhandleConnect()protected voidhandleDisconnect()protected voidhandleMessageBatch(java.io.DataInput in, boolean multicast)java.util.Map<java.lang.String,java.lang.String>handleProbe(java.lang.String... keys)Handles a probe.protected voidhandleSingleMessage(java.io.DataInput in, boolean multicast)voidinit()Called after a protocol has been created and before the protocol is started.booleanisLogicalAddressCacheReaperRunning()booleanisMulticastCapable()booleanisReceiveOnAllInterfaces()booleanisTrace()<T extends TP>
TisTrace(boolean i)PhysicalAddresslocalPhysicalAddress()booleanlogDiscardMsgs()<T extends TP>
TlogDiscardMsgs(boolean l)booleanlogDiscardMsgsVersion()<T extends TP>
TlogDiscardMsgsVersion(boolean l)static java.lang.StringloggerType()MessageProcessingPolicymsgProcessingPolicy()<T extends TP>
TmsgProcessingPolicy(MessageProcessingPolicy p)voidpassBatchUp(MessageBatch batch, boolean perform_cluster_name_matching, boolean discard_own_mcast)voidpassMessageUp(Message msg, byte[] cluster_name, boolean perform_cluster_name_matching, boolean multicast, boolean discard_own_mcast)java.lang.StringprintLogicalAddressCache()java.lang.StringprintWhoHasCache()protected voidprocessBatch(MessageBatch batch, boolean oob)voidreceive(Address sender, byte[] data, int offset, int length)Subclasses must call this method when a unicast or multicast message has been received.voidreceive(Address sender, java.io.DataInput in, int ignoredLength)booleanreceiveOnAllInterfaces()<T extends TP>
TreceiveOnAllInterfaces(boolean r)protected voidregisterLocalAddress(Address addr)Associates the address with the physical address fetched from the cache<T extends TP>
TregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)voidremoveCancelledTimerTasks()protected voidremoveLogicalAddressFromCache(Address logical_addr)voidresetStats()protected booleansameCluster(java.lang.String req)protected voidsendTo(Address dest, byte[] buf, int offset, int length)protected voidsendToAll(byte[] buf, int offset, int length)Fetches the physical addrs for all mbrs and sends the msg to each physical address.abstract voidsendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)Send a unicast to a member.protected voidsendUnicasts(java.util.List<PhysicalAddress> dests, byte[] data, int offset, int length)<T extends Protocol>
TsetAddress(Address addr)<T extends TP>
TsetAsyncExecutor(AsyncExecutor<java.lang.Object> e)<T extends TP>
TsetBindAddr(java.net.InetAddress b)<T extends TP>
TsetBindAddress(java.net.InetAddress a)<T extends TP>
TsetBindPort(int port)<T extends TP>
TsetBindToAllInterfaces(boolean f)<T extends TP>
TsetBundler(Bundler new_bundler)Installs a bundler<T extends TP>
TsetBundlerType(java.lang.String b)<T extends TP>
TsetDiagnosticsHandler(DiagnosticsHandler handler)Sets aDiagnosticsHandler.<T extends TP>
TsetExternalAddr(java.net.InetAddress e)<T extends TP>
TsetExternalPort(int e)protected voidsetInAllThreadFactories(java.lang.String cluster_name, Address local_address, java.lang.String pattern)<T extends Protocol>
TsetLevel(java.lang.String level)Sets the level of a logger.<T extends TP>
TsetLocalTransport(java.lang.String tp_class)<T extends TP>
TsetLocalTransport(LocalTransport l)<T extends TP>
TsetLogDiscardMessages(boolean flag)<T extends TP>
TsetLogDiscardMessagesVersion(boolean f)<T extends TP>
TsetLogicalAddrCacheExpiration(long l)<T extends TP>
TsetLogicalAddrCacheMaxSize(int l)<T extends TP>
TsetLogicalAddrCacheReaperInterval(long l)<T extends TP>
TsetMessageProcessingPolicy(java.lang.String policy)<T extends TP>
TsetPortRange(int range)voidsetSocketFactory(SocketFactory factory)Sets a SocketFactory.protected voidsetSourceAddress(Message msg)If the sender is null, set our own address.<T extends TP>
TsetSuppressTimeDifferentClusterWarnings(long s)<T extends TP>
TsetSuppressTimeDifferentVersionWarnings(long s)<T extends TP>
TsetThreadFactory(ThreadFactory factory)protected voidsetThreadNames()<T extends TP>
TsetThreadPool(java.util.concurrent.Executor thread_pool)<T extends TP>
TsetTimer(TimeScheduler timer)Sets a new timer.<T extends TP>
TsetTimeService(TimeService ts)<T extends TP>
TsetTimeServiceInterval(long t)<T extends TP>
TsetWhoHasCacheTimeout(long w)voidstart()Creates the unicast and multicast sockets and starts the unicast and multicast receiver threadsprotected voidstartDiagnostics()voidstop()Called on aJChannel.disconnect(); stops work (e.g.protected voidstopDiagnostics()java.lang.String[]supportedKeys()Returns a list of supported keysabstract booleansupportsMulticasting()Whether hardware multicasting is supportedprotected longtimestamp()java.lang.StringtoString()booleanunicastDestMismatch(Address dest)<T extends TP>
TunregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)protected voidunsetThreadNames()booleanuseVirtualThreads()<T extends TP>
TuseVirtualThreads(boolean f)protected booleanversionMatch(short version, Address sender)Viewview()-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, down, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setPolicies, setProtocolStack, setUpProtocol, setValue, statsEnabled, up, up, up
-
-
-
-
Field Detail
-
LIST
public static final byte LIST
- See Also:
- Constant Field Values
-
MULTICAST
public static final byte MULTICAST
- See Also:
- Constant Field Values
-
MSG_OVERHEAD
public static final int MSG_OVERHEAD
- See Also:
- Constant Field Values
-
MIN_WAIT_BETWEEN_DISCOVERIES
protected static final long MIN_WAIT_BETWEEN_DISCOVERIES
-
bind_addr
protected java.net.InetAddress bind_addr
-
external_addr
protected java.net.InetAddress external_addr
-
external_port
protected int external_port
-
is_trace
protected boolean is_trace
-
receive_on_all_interfaces
protected boolean receive_on_all_interfaces
-
receive_interfaces
protected java.util.List<java.net.NetworkInterface> receive_interfaces
Listof interfaces to receive multicasts on. The multicast receive socket will listen on all of these interfaces. This is a comma-separated list of IP addresses or interface names. E.g. "192.168.5.1,eth1,127.0.0.1". Duplicates are discarded; we only bind to an interface once. If this property is set, it overrides receive_on_all_interfaces.
-
logical_addr_cache_max_size
protected int logical_addr_cache_max_size
-
logical_addr_cache_expiration
protected long logical_addr_cache_expiration
-
logical_addr_cache_reaper_interval
protected long logical_addr_cache_reaper_interval
-
bind_port
protected int bind_port
The port to which the transport binds. 0 means to bind to any (ephemeral) port. See alsoport_range
-
port_range
protected int port_range
-
message_processing_policy
protected java.lang.String message_processing_policy
-
local_transport_class
protected java.lang.String local_transport_class
-
use_vthreads
protected boolean use_vthreads
-
thread_naming_pattern
protected java.lang.String thread_naming_pattern
-
time_service_interval
protected long time_service_interval
-
log_discard_msgs
protected boolean log_discard_msgs
Whether warnings about messages from different groups are logged - private flag, not for common use
-
log_discard_msgs_version
protected boolean log_discard_msgs_version
-
who_has_cache_timeout
protected long who_has_cache_timeout
-
suppress_time_different_version_warnings
protected long suppress_time_different_version_warnings
-
suppress_time_different_cluster_warnings
protected long suppress_time_different_cluster_warnings
-
bundler_type
protected java.lang.String bundler_type
-
msg_stats
protected final MsgStats msg_stats
-
cluster_name
protected AsciiString cluster_name
The name of the group to which this member is connected. With a shared transport, the channel name is in TP.ProtocolAdapter (cluster_name), and this field is not used
-
timer_handle_non_blocking_tasks
protected boolean timer_handle_non_blocking_tasks
-
local_physical_addr
protected PhysicalAddress local_physical_addr
The address (host and port) of this member
-
view
protected volatile View view
-
members
protected final java.util.Set<Address> members
The members of this group (updated when a member joins or leaves). With a shared transport, members contains _all_ members from all channels sitting on the shared transport
-
connectLock
protected final java.util.concurrent.locks.ReentrantLock connectLock
-
thread_pool
protected ThreadPool thread_pool
The thread pool which handles unmarshalling, version checks and dispatching of messages
-
async_executor
protected AsyncExecutor<java.lang.Object> async_executor
-
thread_factory
protected ThreadFactory thread_factory
Factory which is used by the thread pool
-
timer
protected TimeScheduler timer
-
time_service
protected TimeService time_service
-
socket_factory
protected SocketFactory socket_factory
-
bundler
protected Bundler bundler
-
msg_processing_policy
protected MessageProcessingPolicy msg_processing_policy
-
local_transport
protected LocalTransport local_transport
-
diag_handler
protected DiagnosticsHandler diag_handler
-
rtt
protected RTT rtt
-
header
protected TpHeader header
The header including the cluster name, sent with each message
-
logical_addr_cache
protected LazyRemovalCache<Address,PhysicalAddress> logical_addr_cache
Cache which maintains mappings between logical and physical addresses. When sending a message to a logical address, we look up the physical address from logical_addr_cache and send the message to the physical address
The keys are logical addresses, the values physical addresses
-
last_discovery_request
protected long last_discovery_request
-
logical_addr_cache_reaper
protected java.util.concurrent.Future<?> logical_addr_cache_reaper
-
print_function
protected static final LazyRemovalCache.Printable<Address,LazyRemovalCache.Entry<PhysicalAddress>> print_function
-
who_has_cache
protected ExpiryCache<Address> who_has_cache
Cache keeping track of WHO_HAS requests for physical addresses (given a logical address) and expiring them after who_has_cache_timeout ms
-
suppress_log_different_version
protected SuppressLog<Address> suppress_log_different_version
Log to suppress identical warnings for messages from members with different (incompatible) versions
-
suppress_log_different_cluster
protected SuppressLog<Address> suppress_log_different_cluster
Log to suppress identical warnings for messages from members in different clusters
-
-
Method Detail
-
getBundlerClass
public java.lang.String getBundlerClass()
-
getBindAddr
public java.net.InetAddress getBindAddr()
-
setBindAddr
public <T extends TP> T setBindAddr(java.net.InetAddress b)
-
getExternalAddr
public java.net.InetAddress getExternalAddr()
-
setExternalAddr
public <T extends TP> T setExternalAddr(java.net.InetAddress e)
-
getExternalPort
public int getExternalPort()
-
setExternalPort
public <T extends TP> T setExternalPort(int e)
-
isTrace
public boolean isTrace()
-
isTrace
public <T extends TP> T isTrace(boolean i)
-
receiveOnAllInterfaces
public boolean receiveOnAllInterfaces()
-
receiveOnAllInterfaces
public <T extends TP> T receiveOnAllInterfaces(boolean r)
-
getLogicalAddrCacheMaxSize
public int getLogicalAddrCacheMaxSize()
-
setLogicalAddrCacheMaxSize
public <T extends TP> T setLogicalAddrCacheMaxSize(int l)
-
getLogicalAddrCacheExpiration
public long getLogicalAddrCacheExpiration()
-
setLogicalAddrCacheExpiration
public <T extends TP> T setLogicalAddrCacheExpiration(long l)
-
getLogicalAddrCacheReaperInterval
public long getLogicalAddrCacheReaperInterval()
-
setLogicalAddrCacheReaperInterval
public <T extends TP> T setLogicalAddrCacheReaperInterval(long l)
-
getTimeServiceInterval
public long getTimeServiceInterval()
-
setTimeServiceInterval
public <T extends TP> T setTimeServiceInterval(long t)
-
logDiscardMsgs
public boolean logDiscardMsgs()
-
logDiscardMsgs
public <T extends TP> T logDiscardMsgs(boolean l)
-
logDiscardMsgsVersion
public boolean logDiscardMsgsVersion()
-
logDiscardMsgsVersion
public <T extends TP> T logDiscardMsgsVersion(boolean l)
-
getWhoHasCacheTimeout
public long getWhoHasCacheTimeout()
-
setWhoHasCacheTimeout
public <T extends TP> T setWhoHasCacheTimeout(long w)
-
getSuppressTimeDifferentVersionWarnings
public long getSuppressTimeDifferentVersionWarnings()
-
setSuppressTimeDifferentVersionWarnings
public <T extends TP> T setSuppressTimeDifferentVersionWarnings(long s)
-
getSuppressTimeDifferentClusterWarnings
public long getSuppressTimeDifferentClusterWarnings()
-
setSuppressTimeDifferentClusterWarnings
public <T extends TP> T setSuppressTimeDifferentClusterWarnings(long s)
-
getBundlerType
public java.lang.String getBundlerType()
-
setBundlerType
public <T extends TP> T setBundlerType(java.lang.String b)
-
useVirtualThreads
public <T extends TP> T useVirtualThreads(boolean f)
-
useVirtualThreads
public boolean useVirtualThreads()
-
isLogicalAddressCacheReaperRunning
public boolean isLogicalAddressCacheReaperRunning()
-
setLevel
public <T extends Protocol> T setLevel(java.lang.String level)
Description copied from class:ProtocolSets the level of a logger. This method is used to dynamically change the logging level of a running system, e.g. via JMX. The appender of a level needs to exist.
-
setMessageProcessingPolicy
public <T extends TP> T setMessageProcessingPolicy(java.lang.String policy)
-
getMessageProcessingPolicy
public MessageProcessingPolicy getMessageProcessingPolicy()
-
getTimerClass
public java.lang.String getTimerClass()
-
getClusterName
public java.lang.String getClusterName()
-
getClusterNameAscii
public AsciiString getClusterNameAscii()
-
getDifferentClusterMessages
public int getDifferentClusterMessages()
-
getDifferentVersionMessages
public int getDifferentVersionMessages()
-
clearDifferentClusterCache
public <T extends TP> T clearDifferentClusterCache()
-
clearDifferentVersionCache
public <T extends TP> T clearDifferentVersionCache()
-
enableAllStats
public void enableAllStats(boolean flag)
-
loggerType
public static java.lang.String loggerType()
-
enableBlockingTimerTasks
public <T extends TP> T enableBlockingTimerTasks(boolean flag)
-
getMessageStats
public MsgStats getMessageStats()
-
msgProcessingPolicy
public MessageProcessingPolicy msgProcessingPolicy()
-
msgProcessingPolicy
public <T extends TP> T msgProcessingPolicy(MessageProcessingPolicy p)
-
getRTT
public RTT getRTT()
-
enableStats
public void enableStats(boolean flag)
- Overrides:
enableStatsin classProtocol
-
supportsMulticasting
public abstract boolean supportsMulticasting()
Whether hardware multicasting is supported
-
isMulticastCapable
public boolean isMulticastCapable()
-
getLogicalAddressCache
public LazyRemovalCache<Address,PhysicalAddress> getLogicalAddressCache()
-
setAddress
public <T extends Protocol> T setAddress(Address addr)
- Overrides:
setAddressin classProtocol
-
localPhysicalAddress
public PhysicalAddress localPhysicalAddress()
-
view
public View view()
-
getLocalPhysicalAddress
public java.lang.String getLocalPhysicalAddress()
-
resetStats
public void resetStats()
- Overrides:
resetStatsin classProtocol
-
registerProbeHandler
public <T extends TP> T registerProbeHandler(DiagnosticsHandler.ProbeHandler handler)
-
unregisterProbeHandler
public <T extends TP> T unregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)
-
getDiagnosticsHandler
public DiagnosticsHandler getDiagnosticsHandler()
-
setDiagnosticsHandler
public <T extends TP> T setDiagnosticsHandler(DiagnosticsHandler handler) throws java.lang.Exception
Sets aDiagnosticsHandler. Should be set before the stack is started- Throws:
java.lang.Exception
-
getLocalTransport
public LocalTransport getLocalTransport()
-
setLocalTransport
public <T extends TP> T setLocalTransport(LocalTransport l)
-
setLocalTransport
public <T extends TP> T setLocalTransport(java.lang.String tp_class) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getBundler
public Bundler getBundler()
-
getThreadPool
public ThreadPool getThreadPool()
-
setThreadPool
public <T extends TP> T setThreadPool(java.util.concurrent.Executor thread_pool)
-
getNumRejectedMsgs
@Deprecated public long getNumRejectedMsgs()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getNumberOfThreadDumps
@Deprecated public static long getNumberOfThreadDumps()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getNumUcastMsgsSent
@Deprecated public long getNumUcastMsgsSent()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getNumMcastMsgsSent
@Deprecated public long getNumMcastMsgsSent()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getNumUcastMsgsReceived
@Deprecated public long getNumUcastMsgsReceived()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getNumMcastMsgsReceived
@Deprecated public long getNumMcastMsgsReceived()
Deprecated.Don't remove! https://issues.redhat.com/browse/JGRP-2814
-
getThreadFactory
public ThreadFactory getThreadFactory()
Description copied from class:ProtocolSupposed to be overwritten by subclasses. Usually the transport returns a valid non-null thread factory, but thread factories can also be created by individual protocols- Overrides:
getThreadFactoryin classProtocol- Returns:
-
setThreadFactory
public <T extends TP> T setThreadFactory(ThreadFactory factory)
-
getAsyncExecutor
public AsyncExecutor<java.lang.Object> getAsyncExecutor()
-
setAsyncExecutor
public <T extends TP> T setAsyncExecutor(AsyncExecutor<java.lang.Object> e)
-
getTimer
public TimeScheduler getTimer()
-
setTimer
public <T extends TP> T setTimer(TimeScheduler timer)
Sets a new timer. This should be done before the transport is initialized; be very careful, as replacing a running timer with tasks in it can wreak havoc !- Parameters:
timer-
-
getTimeService
public TimeService getTimeService()
-
setTimeService
public <T extends TP> T setTimeService(TimeService ts)
-
getSocketFactory
public SocketFactory getSocketFactory()
Description copied from class:ProtocolReturns the SocketFactory associated with this protocol, if overridden in a subclass, or passes the call down- Overrides:
getSocketFactoryin classProtocol- Returns:
- SocketFactory
-
setSocketFactory
public void setSocketFactory(SocketFactory factory)
Description copied from class:ProtocolSets a SocketFactory. Socket factories are typically provided by the transport (TP)- Overrides:
setSocketFactoryin classProtocol
-
getThreadNamingPattern
public java.lang.String getThreadNamingPattern()
Names the current thread. Valid values are "cl": c: include the cluster name, e.g. "MyCluster" l: include the local address of the current member, e.g. "192.168.5.1:5678"
-
getBindAddress
public java.net.InetAddress getBindAddress()
-
setBindAddress
public <T extends TP> T setBindAddress(java.net.InetAddress a)
-
getBindPort
public int getBindPort()
-
setBindPort
public <T extends TP> T setBindPort(int port)
-
setBindToAllInterfaces
public <T extends TP> T setBindToAllInterfaces(boolean f)
-
isReceiveOnAllInterfaces
public boolean isReceiveOnAllInterfaces()
-
getReceiveInterfaces
public java.util.List<java.net.NetworkInterface> getReceiveInterfaces()
-
setPortRange
public <T extends TP> T setPortRange(int range)
-
getPortRange
public int getPortRange()
-
getNumTimerTasks
public int getNumTimerTasks()
-
dumpTimerTasks
public java.lang.String dumpTimerTasks()
-
removeCancelledTimerTasks
public void removeCancelledTimerTasks()
-
getTimerThreads
public int getTimerThreads()
-
getNumThreads
public static int getNumThreads()
-
setLogDiscardMessages
public <T extends TP> T setLogDiscardMessages(boolean flag)
-
getLogDiscardMessages
public boolean getLogDiscardMessages()
-
setLogDiscardMessagesVersion
public <T extends TP> T setLogDiscardMessagesVersion(boolean f)
-
getLogDiscardMessagesVersion
public boolean getLogDiscardMessagesVersion()
-
printLogicalAddressCache
public java.lang.String printLogicalAddressCache()
-
printWhoHasCache
public java.lang.String printWhoHasCache()
-
evictLogicalAddressCache
public void evictLogicalAddressCache()
-
evictLogicalAddressCache
public void evictLogicalAddressCache(boolean force)
-
defaultHeaders
public java.lang.String defaultHeaders(boolean detailed)
-
sendUnicast
public abstract void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws java.lang.Exception
Send a unicast to a member. Note that the destination address is a *physical*, not a logical address- Parameters:
dest- Must be a non-null unicast addressdata- The data to be sent. This is not a copy, so don't modify it- Throws:
java.lang.Exception
-
getInfo
public abstract java.lang.String getInfo()
-
init
public void init() throws java.lang.ExceptionDescription copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
-
start
public void start() throws java.lang.ExceptionCreates the unicast and multicast sockets and starts the unicast and multicast receiver threads- Specified by:
startin interfaceLifecycle- Overrides:
startin classProtocol- Throws:
java.lang.Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soJChannel.connect(String)will throw an exception
-
stop
public void stop()
Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
-
destroy
public void destroy()
Description copied from class:ProtocolThis method is called on aJChannel.close(). Does some cleanup; after the call, the VM will terminate
-
bundler
public <T extends TP> T bundler(java.lang.String type) throws java.lang.Exception
- Throws:
java.lang.Exception
-
enableDiagnostics
public <T extends TP> T enableDiagnostics()
-
disableDiagnostics
public void disableDiagnostics()
-
startDiagnostics
protected void startDiagnostics() throws java.lang.Exception- Throws:
java.lang.Exception
-
stopDiagnostics
protected void stopDiagnostics()
-
handleProbe
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
Description copied from interface:DiagnosticsHandler.ProbeHandlerHandles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
handleProbein interfaceDiagnosticsHandler.ProbeHandler- Returns:
- Map
. A map of keys and values. A null return value is permissible.
-
supportedKeys
public java.lang.String[] supportedKeys()
Description copied from interface:DiagnosticsHandler.ProbeHandlerReturns a list of supported keys- Specified by:
supportedKeysin interfaceDiagnosticsHandler.ProbeHandler
-
handleConnect
protected void handleConnect() throws java.lang.Exception- Throws:
java.lang.Exception
-
handleDisconnect
protected void handleDisconnect()
-
down
public java.lang.Object down(Event evt)
Description copied from class:ProtocolAn event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down().
-
down
public java.lang.Object down(Message msg)
A message needs to be sent to a single member or all members
-
createDiagnosticsHandler
protected DiagnosticsHandler createDiagnosticsHandler()
-
createBundler
public static Bundler createBundler(java.lang.String type, java.lang.Class<?> cl) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setSourceAddress
protected void setSourceAddress(Message msg)
If the sender is null, set our own address. We cannot just go ahead and set the address anyway, as we might send a message on behalf of someone else, e.g. in case of retransmission, when the original sender has crashed.
-
passMessageUp
public void passMessageUp(Message msg, byte[] cluster_name, boolean perform_cluster_name_matching, boolean multicast, boolean discard_own_mcast)
-
passBatchUp
public void passBatchUp(MessageBatch batch, boolean perform_cluster_name_matching, boolean discard_own_mcast)
-
sameCluster
protected boolean sameCluster(java.lang.String req)
-
receive
public void receive(Address sender, byte[] data, int offset, int length)
Subclasses must call this method when a unicast or multicast message has been received.
-
receive
public void receive(Address sender, java.io.DataInput in, int ignoredLength) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleMessageBatch
protected void handleMessageBatch(java.io.DataInput in, boolean multicast)
-
handleSingleMessage
protected void handleSingleMessage(java.io.DataInput in, boolean multicast)
-
processBatch
protected void processBatch(MessageBatch batch, boolean oob)
-
unicastDestMismatch
public boolean unicastDestMismatch(Address dest)
-
versionMatch
protected boolean versionMatch(short version, Address sender)
-
doSend
public void doSend(byte[] buf, int offset, int length, Address dest) throws java.lang.Exception- Throws:
java.lang.Exception
-
sendTo
protected void sendTo(Address dest, byte[] buf, int offset, int length) throws java.lang.Exception
- Throws:
java.lang.Exception
-
sendToAll
protected void sendToAll(byte[] buf, int offset, int length) throws java.lang.ExceptionFetches the physical addrs for all mbrs and sends the msg to each physical address. Asks discovery for missing members' physical addresses if needed- Throws:
java.lang.Exception
-
sendUnicasts
protected void sendUnicasts(java.util.List<PhysicalAddress> dests, byte[] data, int offset, int length) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fetchPhysicalAddrs
protected void fetchPhysicalAddrs(java.util.List<Address> missing)
-
fetchResponsesFromDiscoveryProtocol
protected Responses fetchResponsesFromDiscoveryProtocol(java.util.List<Address> missing)
-
timestamp
protected long timestamp()
-
registerLocalAddress
protected void registerLocalAddress(Address addr)
Associates the address with the physical address fetched from the cache- Parameters:
addr-
-
fetchLocalAddresses
protected void fetchLocalAddresses()
Grabs the local address (or addresses in the shared transport case) and registers them with the physical address in the transport's cache
-
setThreadNames
protected void setThreadNames()
-
unsetThreadNames
protected void unsetThreadNames()
-
setInAllThreadFactories
protected void setInAllThreadFactories(java.lang.String cluster_name, Address local_address, java.lang.String pattern)
-
addPhysicalAddressToCache
public boolean addPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr)
-
addPhysicalAddressToCache
protected boolean addPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr, boolean overwrite)
-
getPhysicalAddressFromCache
public PhysicalAddress getPhysicalAddressFromCache(Address logical_addr)
-
getAllPhysicalAddressesFromCache
protected java.util.Collection<PhysicalAddress> getAllPhysicalAddressesFromCache()
-
removeLogicalAddressFromCache
protected void removeLogicalAddressFromCache(Address logical_addr)
-
clearLogicalAddressCache
public void clearLogicalAddressCache()
Clears the cache. Do not use, this is only for unit testing !
-
getPhysicalAddress
protected abstract PhysicalAddress getPhysicalAddress()
-
-