Package org.jgroups.protocols
Class BasicTCP
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.TP
-
- org.jgroups.protocols.BasicTCP
-
- All Implemented Interfaces:
ConnectionListener,Receiver,Lifecycle,DiagnosticsHandler.ProbeHandler
public abstract class BasicTCP extends TP implements Receiver, ConnectionListener
Shared base class for TCP protocols- Author:
- Scott Marlow, Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.InetAddressclient_bind_addrprotected intclient_bind_portprotected longconn_expire_timeprotected booleandefer_client_bind_addrprotected booleanenable_suspect_eventsprotected intlingerprotected booleanlog_detailsprotected intmax_lengthprotected java.util.concurrent.atomic.LongAddernum_suspect_eventsprotected intpeer_addr_read_timeoutprotected longreaper_intervalprotected intrecv_buf_sizeprotected intsend_buf_sizeprotected intsock_conn_timeoutprotected booleantcp_nodelayprotected booleanuse_acksDeprecated, for removal: This API element is subject to removal in a future version.-
Fields inherited from class org.jgroups.protocols.TP
async_executor, bind_addr, bind_port, bundler, bundler_type, cluster_name, connectLock, diag_handler, external_addr, external_port, header, is_trace, last_discovery_request, LIST, local_physical_addr, local_transport, local_transport_class, log_discard_msgs, log_discard_msgs_version, logical_addr_cache, logical_addr_cache_expiration, logical_addr_cache_max_size, logical_addr_cache_reaper, logical_addr_cache_reaper_interval, members, message_processing_policy, MIN_WAIT_BETWEEN_DISCOVERIES, MSG_OVERHEAD, msg_processing_policy, msg_stats, MULTICAST, port_range, print_function, receive_interfaces, receive_on_all_interfaces, rtt, socket_factory, suppress_log_different_cluster, suppress_log_different_version, suppress_time_different_cluster_warnings, suppress_time_different_version_warnings, thread_factory, thread_naming_pattern, thread_pool, time_service, time_service_interval, timer, timer_handle_non_blocking_tasks, use_vthreads, view, who_has_cache, who_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 protectedBasicTCP()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconnectionClosed(Connection conn)voidconnectionEstablished(Connection conn)booleandeferClientBindAddr()BasicTCPdeferClientBindAddr(boolean d)java.lang.Objectdown(Event evt)An event is to be sent down the stack.booleanenableSuspectEvents()BasicTCPenableSuspectEvents(boolean b)java.net.InetAddressgetClientBindAddr()intgetClientBindPort()longgetConnExpireTime()java.lang.StringgetInfo()intgetLinger()intgetMaxLength()intgetPeerAddrReadTimeout()longgetReaperInterval()intgetRecvBufSize()intgetSendBufSize()intgetSockConnTimeout()voidinit()Called after a protocol has been created and before the protocol is started.booleanlogDetails()BasicTCPlogDetails(boolean l)abstract java.lang.StringprintConnections()BasicTCPreaperInterval(long interval)voidresetStats()abstract voidretainAll(java.util.Collection<Address> members)abstract voidsend(Address dest, byte[] data, int offset, int length)voidsendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)Send a unicast to a member.BasicTCPsetClientBindAddr(java.net.InetAddress c)BasicTCPsetClientBindPort(int c)BasicTCPsetConnExpireTime(long time)BasicTCPsetLinger(int l)BasicTCPsetMaxLength(int len)BasicTCPsetPeerAddrReadTimeout(int p)BasicTCPsetReaperInterval(long interval)BasicTCPsetRecvBufSize(int r)BasicTCPsetSendBufSize(int s)BasicTCPsetSockConnTimeout(int s)booleansupportsMulticasting()Whether hardware multicasting is supportedbooleantcpNodelay()BasicTCPtcpNodelay(boolean t)static booleanuseAcks()BasicTCPuseAcks(boolean ignored)-
Methods inherited from class org.jgroups.protocols.TP
addPhysicalAddressToCache, addPhysicalAddressToCache, bundler, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createBundler, createDiagnosticsHandler, defaultHeaders, destroy, disableDiagnostics, doSend, down, dumpTimerTasks, enableAllStats, enableBlockingTimerTasks, enableDiagnostics, enableStats, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getAsyncExecutor, getBindAddr, getBindAddress, getBindPort, getBundler, getBundlerClass, getBundlerType, getClusterName, getClusterNameAscii, getDiagnosticsHandler, getDifferentClusterMessages, getDifferentVersionMessages, getExternalAddr, getExternalPort, getLocalPhysicalAddress, getLocalTransport, getLogDiscardMessages, getLogDiscardMessagesVersion, getLogicalAddrCacheExpiration, getLogicalAddrCacheMaxSize, getLogicalAddrCacheReaperInterval, getLogicalAddressCache, getMessageProcessingPolicy, getMessageStats, getNumberOfThreadDumps, getNumMcastMsgsReceived, getNumMcastMsgsSent, getNumRejectedMsgs, getNumThreads, getNumTimerTasks, getNumUcastMsgsReceived, getNumUcastMsgsSent, getPhysicalAddress, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getRTT, getSocketFactory, getSuppressTimeDifferentClusterWarnings, getSuppressTimeDifferentVersionWarnings, getThreadFactory, getThreadNamingPattern, getThreadPool, getTimer, getTimerClass, getTimerThreads, getTimeService, getTimeServiceInterval, getWhoHasCacheTimeout, handleConnect, handleDisconnect, handleMessageBatch, handleProbe, handleSingleMessage, isLogicalAddressCacheReaperRunning, isMulticastCapable, isReceiveOnAllInterfaces, isTrace, isTrace, localPhysicalAddress, logDiscardMsgs, logDiscardMsgs, logDiscardMsgsVersion, logDiscardMsgsVersion, loggerType, msgProcessingPolicy, msgProcessingPolicy, passBatchUp, passMessageUp, printLogicalAddressCache, printWhoHasCache, processBatch, receive, receive, receiveOnAllInterfaces, receiveOnAllInterfaces, registerLocalAddress, registerProbeHandler, removeCancelledTimerTasks, removeLogicalAddressFromCache, sameCluster, sendTo, sendToAll, sendUnicasts, setAddress, setAsyncExecutor, setBindAddr, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setBundlerType, setDiagnosticsHandler, setExternalAddr, setExternalPort, setInAllThreadFactories, setLevel, setLocalTransport, setLocalTransport, setLogDiscardMessages, setLogDiscardMessagesVersion, setLogicalAddrCacheExpiration, setLogicalAddrCacheMaxSize, setLogicalAddrCacheReaperInterval, setMessageProcessingPolicy, setPortRange, setSocketFactory, setSourceAddress, setSuppressTimeDifferentClusterWarnings, setSuppressTimeDifferentVersionWarnings, setThreadFactory, setThreadNames, setThreadPool, setTimer, setTimeService, setTimeServiceInterval, setWhoHasCacheTimeout, start, startDiagnostics, stop, stopDiagnostics, supportedKeys, timestamp, toString, unicastDestMismatch, unregisterProbeHandler, unsetThreadNames, useVirtualThreads, useVirtualThreads, versionMatch, view
-
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
-
reaper_interval
protected long reaper_interval
-
conn_expire_time
protected long conn_expire_time
-
recv_buf_size
protected int recv_buf_size
-
send_buf_size
protected int send_buf_size
-
sock_conn_timeout
protected int sock_conn_timeout
-
peer_addr_read_timeout
protected int peer_addr_read_timeout
-
max_length
protected int max_length
-
tcp_nodelay
protected boolean tcp_nodelay
-
linger
protected int linger
-
use_acks
@Deprecated(since="5.4.4", forRemoval=true) protected boolean use_acksDeprecated, for removal: This API element is subject to removal in a future version.
-
client_bind_addr
protected java.net.InetAddress client_bind_addr
-
client_bind_port
protected int client_bind_port
-
defer_client_bind_addr
protected boolean defer_client_bind_addr
-
log_details
protected boolean log_details
-
enable_suspect_events
protected boolean enable_suspect_events
-
num_suspect_events
protected final java.util.concurrent.atomic.LongAdder num_suspect_events
-
-
Method Detail
-
supportsMulticasting
public boolean supportsMulticasting()
Description copied from class:TPWhether hardware multicasting is supported- Specified by:
supportsMulticastingin classTP
-
getReaperInterval
public long getReaperInterval()
-
setReaperInterval
public BasicTCP setReaperInterval(long interval)
-
reaperInterval
public BasicTCP reaperInterval(long interval)
-
getConnExpireTime
public long getConnExpireTime()
-
setConnExpireTime
public BasicTCP setConnExpireTime(long time)
-
getRecvBufSize
public int getRecvBufSize()
-
setRecvBufSize
public BasicTCP setRecvBufSize(int r)
-
getSendBufSize
public int getSendBufSize()
-
setSendBufSize
public BasicTCP setSendBufSize(int s)
-
getSockConnTimeout
public int getSockConnTimeout()
-
setSockConnTimeout
public BasicTCP setSockConnTimeout(int s)
-
getMaxLength
public int getMaxLength()
-
setMaxLength
public BasicTCP setMaxLength(int len)
-
getPeerAddrReadTimeout
public int getPeerAddrReadTimeout()
-
setPeerAddrReadTimeout
public BasicTCP setPeerAddrReadTimeout(int p)
-
tcpNodelay
public boolean tcpNodelay()
-
tcpNodelay
public BasicTCP tcpNodelay(boolean t)
-
getLinger
public int getLinger()
-
setLinger
public BasicTCP setLinger(int l)
-
useAcks
public static boolean useAcks()
-
useAcks
public BasicTCP useAcks(boolean ignored)
-
getClientBindAddr
public java.net.InetAddress getClientBindAddr()
-
setClientBindAddr
public BasicTCP setClientBindAddr(java.net.InetAddress c)
-
getClientBindPort
public int getClientBindPort()
-
setClientBindPort
public BasicTCP setClientBindPort(int c)
-
deferClientBindAddr
public boolean deferClientBindAddr()
-
deferClientBindAddr
public BasicTCP deferClientBindAddr(boolean d)
-
logDetails
public boolean logDetails()
-
logDetails
public BasicTCP logDetails(boolean l)
-
enableSuspectEvents
public boolean enableSuspectEvents()
-
enableSuspectEvents
public BasicTCP enableSuspectEvents(boolean b)
-
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.
-
sendUnicast
public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws java.lang.Exception
Description copied from class:TPSend a unicast to a member. Note that the destination address is a *physical*, not a logical address- Specified by:
sendUnicastin classTP- 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
-
printConnections
public abstract java.lang.String printConnections()
-
send
public abstract void send(Address dest, byte[] data, int offset, int length) throws java.lang.Exception
- Throws:
java.lang.Exception
-
retainAll
public abstract void retainAll(java.util.Collection<Address> members)
-
resetStats
public void resetStats()
- Overrides:
resetStatsin classTP
-
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().
-
connectionClosed
public void connectionClosed(Connection conn)
- Specified by:
connectionClosedin interfaceConnectionListener
-
connectionEstablished
public void connectionEstablished(Connection conn)
- Specified by:
connectionEstablishedin interfaceConnectionListener
-
-