Class BasicTCP
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.TPConfig
org.jgroups.protocols.TP
org.jgroups.protocols.BasicTCP
- All Implemented Interfaces:
ConnectionListener, Receiver, Lifecycle, DiagnosticsHandler.ProbeHandler
Shared base class for TCP protocols
- Author:
- Scott Marlow, Bela Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InetAddressprotected intprotected longprotected booleanIndicates whether the transport is connected to the cluster.protected booleanprotected booleanprotected final Predicate<PhysicalAddress> protected intprotected booleanprotected intprotected final LongAdderprotected intprotected longprotected intprotected intprotected intprotected booleanprotected booleanDeprecated, for removal: This API element is subject to removal in a future version.Fields inherited from class TP
LIST, MIN_WAIT_BETWEEN_DISCOVERIES, MSG_OVERHEAD, MULTICASTFields inherited from class TPConfig
async_executor, bind_addr, bind_port, bundler, bundler_type, cluster_name, connectLock, diag_handler, external_addr, external_port, header, is_trace, last_discovery_request, 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, msg_processing_policy, msg_stats, 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_direct_memory, use_vthreads, view, who_has_cache, who_has_cache_timeoutFields inherited from class Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, preview_warning, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract BasicTCPclearConnections(boolean graceful) voidconnectionClosed(Connection conn) voidbooleandeferClientBindAddr(boolean d) An event is to be sent down the stack.booleanenableSuspectEvents(boolean b) intlongintintintlongintintintvoidinit()Called after a protocol has been created and before the protocol is started.booleanlogDetails(boolean l) longabstract StringreaperInterval(long interval) voidabstract voidretainAll(Collection<Address> members) setClientBindPort(int c) setConnExpireTime(long time) setLinger(int l) setMaxLength(int len) setPeerAddrReadTimeout(int p) setReaperInterval(long interval) setRecvBufSize(int r) setSendBufSize(int s) setSockConnTimeout(int s) booleanWhether hardware multicasting is supportedbooleantcpNodelay(boolean t) static booleanuseAcks()useAcks(boolean ignored) Methods inherited from class TP
addPhysicalAddressToCache, addPhysicalAddressToCache, clearLogicalAddressCache, destroy, disableDiagnostics, doSend, down, enableDiagnostics, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getPhysicalAddress, getPhysicalAddressFromCache, handleConnect, handleDisconnect, handleMessageBatch, handleProbe, handleSingleMessage, passBatchUp, passMessageUp, processBatch, receive, receive, registerLocalAddress, removeLogicalAddressFromCache, sendTo, sendToAll, sendUnicast, sendUnicasts, setAddress, setInAllThreadFactories, setSourceAddress, setThreadNames, start, startDiagnostics, stop, stopDiagnostics, supportedKeys, toString, unicastDestMismatch, unsetThreadNames, versionMatchMethods inherited from class TPConfig
bundler, clearDifferentClusterCache, clearDifferentVersionCache, clusterName, createBundler, createDiagnosticsHandler, defaultHeaders, dumpTimerTasks, enableAllStats, enableBlockingTimerTasks, enableStats, 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, getPortRange, getReceiveInterfaces, getRTT, getSocketFactory, getSuppressTimeDifferentClusterWarnings, getSuppressTimeDifferentVersionWarnings, getThreadFactory, getThreadNamingPattern, getThreadPool, getTimer, getTimerClass, getTimerThreads, getTimeService, getTimeServiceInterval, getWhoHasCacheTimeout, isLogicalAddressCacheReaperRunning, isReceiveOnAllInterfaces, isTrace, isTrace, localPhysicalAddress, logDiscardMsgs, logDiscardMsgs, logDiscardMsgsVersion, logDiscardMsgsVersion, loggerType, msgProcessingPolicy, msgProcessingPolicy, printLogicalAddressCache, printWhoHasCache, receiveOnAllInterfaces, receiveOnAllInterfaces, registerProbeHandler, removeCancelledTimerTasks, sameCluster, setAsyncExecutor, setBindAddr, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setBundlerType, setDiagnosticsHandler, setExternalAddr, setExternalPort, setLevel, setLocalTransport, setLocalTransport, setLogDiscardMessages, setLogDiscardMessagesVersion, setLogicalAddrCacheExpiration, setLogicalAddrCacheMaxSize, setLogicalAddrCacheReaperInterval, setMessageProcessingPolicy, setMessageStats, setPortRange, setSocketFactory, setSuppressTimeDifferentClusterWarnings, setSuppressTimeDifferentVersionWarnings, setThreadFactory, setThreadPool, setTimer, setTimeService, setTimeServiceInterval, setWhoHasCacheTimeout, threadNamingPattern, timestamp, unregisterProbeHandler, unregisterProbeHandler, useDirectMemory, useDirectMemory, useVirtualThreads, useVirtualThreads, viewMethods inherited from class 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, previewWarning, previewWarning, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setPolicies, setProtocolStack, setUpProtocol, setValue, statsEnabled, up, up, up
-
Field Details
-
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, for removal: This API element is subject to removal in a future version. -
connected
protected volatile boolean connectedIndicates whether the transport is connected to the cluster. Used by TCP-based transports to skip SUSPECT events during graceful disconnect when connections are closed. -
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
-
is_member
-
-
Constructor Details
-
BasicTCP
protected BasicTCP()
-
-
Method Details
-
supportsMulticasting
public boolean supportsMulticasting()Description copied from class:TPWhether hardware multicasting is supported- Specified by:
supportsMulticastingin classTP
-
getReaperInterval
public long getReaperInterval() -
setReaperInterval
-
reaperInterval
-
getConnExpireTime
public long getConnExpireTime() -
setConnExpireTime
-
getRecvBufSize
public int getRecvBufSize() -
setRecvBufSize
-
getSendBufSize
public int getSendBufSize() -
setSendBufSize
-
getSockConnTimeout
public int getSockConnTimeout() -
setSockConnTimeout
-
getMaxLength
public int getMaxLength() -
setMaxLength
-
getPeerAddrReadTimeout
public int getPeerAddrReadTimeout() -
setPeerAddrReadTimeout
-
tcpNodelay
public boolean tcpNodelay() -
tcpNodelay
-
getLinger
public int getLinger() -
setLinger
-
useAcks
public static boolean useAcks() -
useAcks
-
getClientBindAddr
-
setClientBindAddr
-
getClientBindPort
public int getClientBindPort() -
setClientBindPort
-
deferClientBindAddr
public boolean deferClientBindAddr() -
deferClientBindAddr
-
logDetails
public boolean logDetails() -
logDetails
-
enableSuspectEvents
public boolean enableSuspectEvents() -
enableSuspectEvents
-
numSuspectEvents
public long numSuspectEvents() -
init
Description 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. -
printConnections
-
clearConnections
-
retainAll
-
resetStats
public void resetStats()- Overrides:
resetStatsin classTPConfig
-
down
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
- Specified by:
connectionClosedin interfaceConnectionListener
-
connectionEstablished
- Specified by:
connectionEstablishedin interfaceConnectionListener
-