public abstract class TP extends Protocol implements DiagnosticsHandler.ProbeHandler
sendMulticast(org.jgroups.util.AsciiString, byte[], int, int)
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 themselves
destroy()
receive(Address, byte[], int, int)
method must
be called by subclasses when a unicast or multicast message has been received.Modifier and Type | Class and Description |
---|---|
protected class |
TP.BatchHandler |
static class |
TP.ProtocolAdapter
Used when the transport is shared (singleton_name != null).
|
protected class |
TP.SingleMessageHandler |
protected class |
TP.SingleMessageHandlerWithClusterName |
Modifier and Type | Field and Description |
---|---|
protected Average |
avg_batch_size |
protected java.net.InetAddress |
bind_addr |
protected java.lang.String |
bind_interface_str |
protected int |
bind_port
The port to which the transport binds.
|
static java.lang.String |
BUNDLE_MSG |
protected Bundler |
bundler |
protected int |
bundler_capacity |
protected int |
bundler_num_spins |
protected java.lang.String |
bundler_type |
protected java.lang.String |
bundler_wait_strategy |
protected static boolean |
can_bind_to_mcast_addr |
protected AsciiString |
cluster_name
The name of the group to which this member is connected.
|
protected int |
connect_count
Keeps track of connects and disconnects, in order to start and stop threads
|
protected java.util.concurrent.locks.ReentrantLock |
connectLock |
protected ThreadFactory |
default_thread_factory
Factory which is used by oob_thread_pool
|
protected DiagnosticsHandler |
diag_handler |
protected java.net.InetAddress |
diagnostics_addr |
protected java.util.List<java.net.NetworkInterface> |
diagnostics_bind_interfaces |
protected java.lang.String |
diagnostics_passcode |
protected int |
diagnostics_port |
protected int |
diagnostics_ttl |
protected boolean |
discard_incompatible_packets
Deprecated.
|
protected boolean |
enable_batching |
protected boolean |
enable_bundling
Deprecated.
|
protected boolean |
enable_diagnostics |
protected boolean |
enable_unicast_bundling
Deprecated.
|
protected java.net.InetAddress |
external_addr |
protected int |
external_port |
protected static java.text.NumberFormat |
f |
protected ThreadFactory |
global_thread_factory
Used by all threads created by JGroups outside of the thread pools
|
protected TpHeader |
header
The header including the cluster name, sent with each message.
|
protected boolean |
ignore_dont_bundle |
protected ThreadFactory |
internal_thread_factory
Factory which is used by internal_thread_pool
|
protected java.util.concurrent.Executor |
internal_thread_pool
The thread pool which handles JGroups internal messages (Flag.INTERNAL)
|
protected boolean |
internal_thread_pool_enabled
Deprecated.
|
protected long |
internal_thread_pool_keep_alive_time |
protected int |
internal_thread_pool_max_threads |
protected int |
internal_thread_pool_min_threads |
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> |
internal_thread_pool_queue
Used if thread_pool is a ThreadPoolExecutor and thread_pool_queue_enabled is true
|
protected boolean |
internal_thread_pool_queue_enabled |
protected int |
internal_thread_pool_queue_max_size |
protected java.lang.String |
internal_thread_pool_rejection_policy |
protected long |
last_discovery_request |
static byte |
LIST |
protected Address |
local_addr
The address (host and port) of this member.
|
protected PhysicalAddress |
local_physical_addr |
protected boolean |
log_discard_msgs
Whether or not warnings about messages from different groups are logged - private flag, not for common use
|
protected boolean |
log_discard_msgs_version |
protected LazyRemovalCache<Address,PhysicalAddress> |
logical_addr_cache
Cache which maintains mappings between logical and physical addresses.
|
protected long |
logical_addr_cache_expiration |
protected int |
logical_addr_cache_max_size |
protected long |
logical_addr_cache_reaper_interval |
protected boolean |
loopback
Deprecated.
|
protected boolean |
loopback_copy |
protected boolean |
loopback_separate_thread |
protected int |
max_bundle_size
Maximum number of bytes for messages to be queued until they are sent.
|
protected long |
max_bundle_timeout
Deprecated.
|
protected java.util.Set<Address> |
members
The members of this group (updated when a member joins or leaves).
|
protected static long |
MIN_WAIT_BETWEEN_DISCOVERIES |
static int |
MSG_OVERHEAD |
static byte |
MULTICAST |
protected int |
no_bundler_initial_buf_size |
protected int |
no_bundler_pool_size |
protected long |
num_batches_received |
protected long |
num_batches_sent |
protected long |
num_bytes_received |
protected long |
num_bytes_sent |
protected long |
num_incoming_msgs_received |
protected long |
num_internal_msgs_received |
protected long |
num_msgs_received |
protected long |
num_msgs_sent |
protected long |
num_oob_msgs_received |
protected int |
num_rejected_msgs |
protected long |
num_single_msgs_received |
protected long |
num_single_msgs_sent |
protected long |
num_single_msgs_sent_instead_of_batch |
protected ThreadFactory |
oob_thread_factory
Factory which is used by oob_thread_pool
|
protected java.util.concurrent.Executor |
oob_thread_pool |
protected boolean |
oob_thread_pool_enabled
Deprecated.
|
protected long |
oob_thread_pool_keep_alive_time |
protected int |
oob_thread_pool_max_threads |
protected int |
oob_thread_pool_min_threads |
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> |
oob_thread_pool_queue
Used if oob_thread_pool is a ThreadPoolExecutor and oob_thread_pool_queue_enabled is true
|
protected boolean |
oob_thread_pool_queue_enabled |
protected int |
oob_thread_pool_queue_max_size |
protected java.lang.String |
oob_thread_pool_rejection_policy |
protected int |
physical_addr_max_fetch_attempts |
protected int |
port_range |
protected java.util.List<DiagnosticsHandler.ProbeHandler> |
preregistered_probe_handlers |
protected static LazyRemovalCache.Printable<Address,LazyRemovalCache.Entry<PhysicalAddress>> |
print_function |
protected java.util.List<java.net.NetworkInterface> |
receive_interfaces
List
|
protected boolean |
receive_on_all_interfaces |
protected java.lang.String |
singleton_name
Deprecated.
|
protected SocketFactory |
socket_factory |
protected SuppressLog<Address> |
suppress_log_different_cluster
Log to suppress identical warnings for messages from members in different clusters
|
protected SuppressLog<Address> |
suppress_log_different_version
Log to suppress identical warnings for messages from members with different (incompatible) versions
|
protected long |
suppress_time_different_cluster_warnings |
protected long |
suppress_time_different_version_warnings |
protected java.lang.String |
thread_naming_pattern |
protected java.util.concurrent.Executor |
thread_pool
The thread pool which handles unmarshalling, version checks and dispatching of regular messages
|
protected boolean |
thread_pool_enabled
Deprecated.
|
protected long |
thread_pool_keep_alive_time |
protected int |
thread_pool_max_threads |
protected int |
thread_pool_min_threads |
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> |
thread_pool_queue
Used if thread_pool is a ThreadPoolExecutor and thread_pool_queue_enabled is true
|
protected boolean |
thread_pool_queue_enabled |
protected int |
thread_pool_queue_max_size |
protected java.lang.String |
thread_pool_rejection_policy |
protected long |
tick_time |
protected TimeService |
time_service |
protected long |
time_service_interval |
protected TimeScheduler |
timer |
protected long |
timer_keep_alive_time |
protected int |
timer_max_threads |
protected int |
timer_min_threads |
protected int |
timer_queue_max_size |
protected java.lang.String |
timer_rejection_policy |
protected ThreadFactory |
timer_thread_factory |
protected java.lang.String |
timer_type |
protected java.util.concurrent.ConcurrentMap<AsciiString,Protocol> |
up_prots
If singleton_name is enabled, this map is used to de-multiplex incoming messages according to their cluster
names (attached to the message by the transport anyway).
|
protected View |
view |
protected int |
wheel_size |
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
|
protected long |
who_has_cache_timeout |
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Modifier | Constructor and Description |
---|---|
protected |
TP()
Creates the TP protocol, and initializes the state variables, does
however not start any sockets or threads.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_send(Message msg,
Address dest) |
protected boolean |
addPhysicalAddressToCache(Address logical_addr,
PhysicalAddress physical_addr) |
protected static int |
assertPositive(int value,
java.lang.String message) |
void |
bundler(java.lang.String type) |
int |
bundlerNumSpins() |
void |
bundlerNumSpins(int spins) |
java.lang.String |
bundlerWaitStrategy() |
void |
bundlerWaitStrategy(java.lang.String strategy) |
void |
clearDifferentClusterCache() |
void |
clearDifferentVersionCache() |
void |
clearLogicalAddressCache()
Clears the cache.
|
protected Bundler |
createBundler(java.lang.String type) |
protected static java.util.concurrent.ExecutorService |
createThreadPool(int min_threads,
int max_threads,
long keep_alive_time,
java.lang.String rejection_policy,
java.util.concurrent.BlockingQueue<java.lang.Runnable> queue,
ThreadFactory factory) |
void |
destroy()
This method is called on a
Channel.close() . |
void |
disableDiagnostics() |
protected void |
doSend(AsciiString cluster_name,
byte[] buf,
int offset,
int length,
Address dest) |
java.lang.Object |
down(Event evt)
Caller by the layer above this layer.
|
java.lang.String |
dumpTimerTasks() |
void |
enableDiagnostics() |
void |
evictLogicalAddressCache() |
void |
evictLogicalAddressCache(boolean force) |
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
|
protected void |
fetchPhysicalAddrs(java.util.List<Address> missing) |
protected Responses |
fetchResponsesFromDiscoveryProtocol(java.util.List<Address> missing) |
protected java.util.Collection<PhysicalAddress> |
getAllPhysicalAddressesFromCache() |
double |
getAvgBatchSize() |
java.net.InetAddress |
getBindAddress() |
int |
getBindPort() |
Bundler |
getBundler() |
int |
getBundlerBufferSize() |
int |
getBundlerCapacity() |
java.lang.String |
getBundlerClass() |
java.lang.String |
getClusterName() |
protected AsciiString |
getClusterName(Message msg) |
AsciiString |
getClusterNameAscii() |
java.util.concurrent.Executor |
getDefaultThreadPool() |
ThreadFactory |
getDefaultThreadPoolThreadFactory() |
int |
getDifferentClusterMessages() |
int |
getDifferentVersionMessages() |
abstract java.lang.String |
getInfo() |
int |
getInternalMaxQueueSize() |
long |
getInternalMessages() |
int |
getInternalPoolSize() |
int |
getInternalPoolSizeActive() |
int |
getInternalQueueSize() |
java.util.concurrent.Executor |
getInternalThreadPool() |
ThreadFactory |
getInternalThreadPoolThreadFactory() |
java.lang.String |
getLocalAddress() |
java.lang.String |
getLocalPhysicalAddress() |
boolean |
getLogDiscardMessages() |
boolean |
getLogDiscardMessagesVersion() |
int |
getMaxBundleSize() |
long |
getMaxBundleTimeout() |
long |
getNumBytesReceived() |
long |
getNumBytesSent() |
long |
getNumMessagesReceived() |
long |
getNumMessagesSent() |
static int |
getNumThreads() |
int |
getNumTimerTasks() |
int |
getOOBMaxQueueSize() |
long |
getOOBMessages() |
int |
getOOBPoolSize() |
int |
getOOBPoolSizeActive() |
int |
getOOBQueueSize() |
java.util.concurrent.Executor |
getOOBThreadPool() |
long |
getOOBThreadPoolKeepAliveTime() |
int |
getOOBThreadPoolMaxThreads() |
int |
getOOBThreadPoolMinThreads() |
ThreadFactory |
getOOBThreadPoolThreadFactory() |
protected abstract PhysicalAddress |
getPhysicalAddress() |
protected PhysicalAddress |
getPhysicalAddressFromCache(Address logical_addr) |
int |
getPortRange() |
java.util.List<java.net.NetworkInterface> |
getReceiveInterfaces() |
int |
getRegularMaxQueueSize() |
long |
getRegularMessages() |
int |
getRegularPoolSize() |
int |
getRegularPoolSizeActive() |
int |
getRegularQueueSize() |
java.lang.String |
getSingletonName() |
SocketFactory |
getSocketFactory()
Returns the SocketFactory associated with this protocol, if overridden in a subclass, or passes the call down
|
ThreadFactory |
getThreadFactory()
Supposed to be overwritten by subclasses.
|
java.lang.String |
getThreadNamingPattern()
Names the current thread.
|
long |
getThreadPoolKeepAliveTime() |
int |
getThreadPoolMaxThreads() |
int |
getThreadPoolMinThreads() |
TimeScheduler |
getTimer() |
java.lang.String |
getTimerClass() |
long |
getTimerKeepAliveTime() |
int |
getTimerMaxThreads() |
int |
getTimerMinThreads() |
int |
getTimerQueueSize() |
ThreadFactory |
getTimerThreadFactory() |
int |
getTimerThreads() |
TimeService |
getTimeService() |
java.util.concurrent.ConcurrentMap<AsciiString,Protocol> |
getUpProtocols() |
protected void |
handleConnect() |
protected void |
handleDisconnect() |
protected java.lang.Object |
handleDownEvent(Event evt) |
protected void |
handleMessageBatch(Address sender,
byte[] data,
int offset,
int length) |
java.util.Map<java.lang.String,java.lang.String> |
handleProbe(java.lang.String... keys)
Handles a probe.
|
protected void |
handleSingleMessage(Address sender,
byte[] data,
int offset,
int length) |
void |
incrBatchesSent() |
void |
incrBatchesSent(int delta) |
void |
incrSingleMsgsInsteadOfBatches() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isDefaulThreadPoolEnabled() |
boolean |
isDiagnosticsHandlerRunning() |
static boolean |
isDiscardIncompatiblePackets()
Deprecated.
|
static boolean |
isEnableBundling()
Deprecated.
|
static boolean |
isEnableUnicastBundling()
Deprecated.
|
boolean |
isLogicalAddressCacheReaperRunning() |
boolean |
isLoopback()
Deprecated.
|
boolean |
isMulticastCapable() |
boolean |
isOOBThreadPoolEnabled() |
boolean |
isReceiveOnAllInterfaces() |
boolean |
isSingleton() |
Address |
localAddress() |
static java.lang.String |
loggerType() |
protected void |
loopback(Message msg,
boolean multicast) |
protected void |
passBatchUp(MessageBatch batch,
boolean perform_cluster_name_matching,
boolean discard_own_mcast) |
protected void |
passMessageUp(Message msg,
AsciiString cluster_name,
boolean perform_cluster_name_matching,
boolean multicast,
boolean discard_own_mcast) |
protected void |
passToAllUpProtocols(Event evt) |
protected java.util.concurrent.Executor |
pickThreadPool(boolean oob,
boolean internal) |
java.lang.String |
printLogicalAddressCache() |
java.lang.String |
printWhoHasCache() |
static Message |
readMessage(java.io.DataInput instream) |
static MessageBatch[] |
readMessageBatch(java.io.DataInput in,
boolean multicast)
Reads a list of messages into 4 MessageBatches:
regular
OOB
INTERNAL-OOB (INTERNAL and OOB)
INTERNAL (INTERNAL)
|
static java.util.List<Message> |
readMessageList(java.io.DataInput in,
short transport_id) |
void |
receive(Address sender,
byte[] data,
int offset,
int length)
Subclasses must call this method when a unicast or multicast message has been received.
|
protected void |
registerLocalAddress(Address addr)
Associates the address with the physical address fetched from the cache
|
void |
registerProbeHandler(DiagnosticsHandler.ProbeHandler handler) |
protected void |
removeAndDispatchNonBundledMessages(MessageBatch... oob_batches)
Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool.
|
protected void |
removeLogicalAddressFromCache(Address logical_addr) |
void |
resetStats() |
protected void |
send(Message msg,
Address dest)
Serializes and sends a message.
|
abstract void |
sendMulticast(AsciiString cluster_name,
byte[] data,
int offset,
int length)
Send to all members in the group.
|
protected void |
sendToMembers(java.util.Collection<Address> mbrs,
byte[] buf,
int offset,
int length)
Fetches the physical addrs for mbrs and sends the msg to each physical address.
|
protected void |
sendToSingleMember(Address dest,
byte[] buf,
int offset,
int length) |
abstract void |
sendUnicast(PhysicalAddress dest,
byte[] data,
int offset,
int length)
Send a unicast to 1 member.
|
TP |
setBindAddress(java.net.InetAddress bind_addr) |
void |
setBindPort(int port) |
void |
setBindToAllInterfaces(boolean flag) |
void |
setBundler(Bundler bundler)
Installs a bundler.
|
void |
setDefaultThreadPool(java.util.concurrent.Executor thread_pool) |
void |
setDefaultThreadPoolThreadFactory(ThreadFactory factory) |
void |
setDiagnosticsHandler(DiagnosticsHandler handler)
Sets a
DiagnosticsHandler . |
static void |
setDiscardIncompatiblePackets(boolean flag)
Deprecated.
|
void |
setEnableBundling(boolean flag)
Deprecated.
|
void |
setEnableUnicastBundling(boolean enable_unicast_bundling)
Deprecated.
|
protected void |
setInAllThreadFactories(java.lang.String cluster_name,
Address local_address,
java.lang.String pattern) |
void |
setInternalThreadPool(java.util.concurrent.Executor internal_thread_pool) |
void |
setInternalThreadPoolThreadFactory(ThreadFactory factory) |
void |
setLogDiscardMessages(boolean flag) |
void |
setLogDiscardMessagesVersion(boolean flag) |
void |
setLoopback(boolean b)
Deprecated.
|
void |
setMaxBundleSize(int size) |
void |
setMaxBundleTimeout(long timeout) |
void |
setOOBRejectionPolicy(java.lang.String rejection_policy) |
void |
setOOBThreadPool(java.util.concurrent.Executor oob_thread_pool) |
void |
setOOBThreadPoolKeepAliveTime(long time) |
void |
setOOBThreadPoolMaxThreads(int size) |
void |
setOOBThreadPoolMinThreads(int size) |
void |
setOOBThreadPoolQueueEnabled(boolean flag) |
void |
setOOBThreadPoolThreadFactory(ThreadFactory factory) |
protected void |
setPingData(PingData data) |
void |
setPortRange(int range) |
void |
setRegularRejectionPolicy(java.lang.String rejection_policy) |
void |
setSocketFactory(SocketFactory factory)
Sets a SocketFactory.
|
protected void |
setSourceAddress(Message msg)
If the sender is null, set our own address.
|
void |
setThreadFactory(ThreadFactory factory) |
protected void |
setThreadNames() |
void |
setThreadPoolKeepAliveTime(long time) |
void |
setThreadPoolMaxThreads(int size) |
void |
setThreadPoolMinThreads(int size) |
void |
setThreadPoolQueueEnabled(boolean flag) |
void |
setTimer(TimeScheduler timer)
Sets a new timer.
|
void |
setTimerKeepAliveTime(long time) |
void |
setTimerMaxThreads(int size) |
void |
setTimerMinThreads(int size) |
void |
setTimerThreadFactory(ThreadFactory factory) |
void |
setTimeService(TimeService ts) |
protected static void |
shutdownThreadPool(java.util.concurrent.Executor thread_pool) |
void |
start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
|
protected void |
startDiagnostics() |
void |
stop()
This method is called on a
Channel.disconnect() . |
protected void |
stopDiagnostics() |
java.lang.String[] |
supportedKeys()
Returns a list of supported keys
|
abstract boolean |
supportsMulticasting()
Whether or not hardware multicasting is supported
|
java.lang.String |
toString() |
void |
unregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler) |
protected void |
unsetThreadNames() |
java.lang.Object |
up(Event evt)
handle the UP event.
|
protected boolean |
versionMatch(short version,
Address sender) |
View |
view() |
protected static void |
writeMessage(Message msg,
java.io.DataOutput dos,
boolean multicast)
This method needs to be synchronized on out_stream when it is called
|
static void |
writeMessageList(Address dest,
Address src,
byte[] cluster_name,
java.util.List<Message> msgs,
java.io.DataOutput dos,
boolean multicast,
short transport_id)
Write a list of messages with the *same* destination and src addresses.
|
static void |
writeMessageListHeader(Address dest,
Address src,
byte[] cluster_name,
int numMsgs,
java.io.DataOutput dos,
boolean multicast) |
accept, afterCreationHook, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setUpProtocol, setValue, setValues, statsEnabled, up
public static final byte LIST
public static final byte MULTICAST
public static final int MSG_OVERHEAD
public static final java.lang.String BUNDLE_MSG
protected static final long MIN_WAIT_BETWEEN_DISCOVERIES
protected static final boolean can_bind_to_mcast_addr
protected static java.text.NumberFormat f
protected java.net.InetAddress bind_addr
protected java.net.InetAddress external_addr
protected int external_port
protected java.lang.String bind_interface_str
protected boolean receive_on_all_interfaces
protected java.util.List<java.net.NetworkInterface> receive_interfaces
protected int logical_addr_cache_max_size
protected long logical_addr_cache_expiration
protected long logical_addr_cache_reaper_interval
protected int bind_port
port_range
protected int port_range
@Deprecated protected boolean loopback
protected boolean loopback_copy
protected boolean loopback_separate_thread
@Deprecated protected boolean discard_incompatible_packets
protected java.lang.String thread_naming_pattern
@Deprecated protected boolean oob_thread_pool_enabled
protected int oob_thread_pool_min_threads
protected int oob_thread_pool_max_threads
protected long oob_thread_pool_keep_alive_time
protected boolean oob_thread_pool_queue_enabled
protected int oob_thread_pool_queue_max_size
protected java.lang.String oob_thread_pool_rejection_policy
protected int thread_pool_min_threads
protected int thread_pool_max_threads
protected long thread_pool_keep_alive_time
@Deprecated protected boolean thread_pool_enabled
protected boolean thread_pool_queue_enabled
protected int thread_pool_queue_max_size
protected java.lang.String thread_pool_rejection_policy
@Deprecated protected boolean internal_thread_pool_enabled
protected int internal_thread_pool_min_threads
protected int internal_thread_pool_max_threads
protected long internal_thread_pool_keep_alive_time
protected boolean internal_thread_pool_queue_enabled
protected int internal_thread_pool_queue_max_size
protected java.lang.String internal_thread_pool_rejection_policy
protected java.lang.String timer_type
protected int timer_min_threads
protected int timer_max_threads
protected long timer_keep_alive_time
protected int timer_queue_max_size
protected java.lang.String timer_rejection_policy
protected int wheel_size
protected long tick_time
protected long time_service_interval
@Deprecated protected boolean enable_bundling
@Deprecated protected boolean enable_unicast_bundling
protected boolean enable_batching
protected boolean ignore_dont_bundle
protected boolean enable_diagnostics
protected java.net.InetAddress diagnostics_addr
protected java.util.List<java.net.NetworkInterface> diagnostics_bind_interfaces
protected int diagnostics_port
protected int diagnostics_ttl
protected java.lang.String diagnostics_passcode
@Deprecated protected java.lang.String singleton_name
protected boolean log_discard_msgs
protected boolean log_discard_msgs_version
protected long who_has_cache_timeout
protected int physical_addr_max_fetch_attempts
protected long suppress_time_different_version_warnings
protected long suppress_time_different_cluster_warnings
protected int max_bundle_size
@Deprecated protected long max_bundle_timeout
protected java.lang.String bundler_type
protected int bundler_capacity
protected int no_bundler_pool_size
protected int no_bundler_initial_buf_size
protected int bundler_num_spins
protected java.lang.String bundler_wait_strategy
protected long num_msgs_sent
protected long num_msgs_received
protected long num_single_msgs_received
protected long num_single_msgs_sent
protected long num_single_msgs_sent_instead_of_batch
protected long num_batches_received
protected long num_batches_sent
protected long num_bytes_sent
protected long num_bytes_received
protected int num_rejected_msgs
protected AsciiString cluster_name
protected long num_oob_msgs_received
protected long num_incoming_msgs_received
protected long num_internal_msgs_received
protected Address local_addr
protected PhysicalAddress local_physical_addr
protected volatile View view
protected final java.util.Set<Address> members
protected int connect_count
protected final java.util.concurrent.locks.ReentrantLock connectLock
protected java.util.concurrent.Executor oob_thread_pool
protected ThreadFactory oob_thread_factory
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> oob_thread_pool_queue
protected java.util.concurrent.Executor thread_pool
protected ThreadFactory default_thread_factory
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> thread_pool_queue
protected java.util.concurrent.Executor internal_thread_pool
protected ThreadFactory internal_thread_factory
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> internal_thread_pool_queue
protected TimeScheduler timer
protected ThreadFactory timer_thread_factory
protected TimeService time_service
protected ThreadFactory global_thread_factory
protected SocketFactory socket_factory
protected volatile Bundler bundler
protected DiagnosticsHandler diag_handler
protected final java.util.List<DiagnosticsHandler.ProbeHandler> preregistered_probe_handlers
protected final java.util.concurrent.ConcurrentMap<AsciiString,Protocol> up_prots
protected TpHeader header
protected LazyRemovalCache<Address,PhysicalAddress> logical_addr_cache
protected long last_discovery_request
protected final Average avg_batch_size
protected static final LazyRemovalCache.Printable<Address,LazyRemovalCache.Entry<PhysicalAddress>> print_function
protected ExpiryCache<Address> who_has_cache
protected SuppressLog<Address> suppress_log_different_version
protected SuppressLog<Address> suppress_log_different_cluster
protected TP()
public java.lang.String getBundlerClass()
public void setMaxBundleSize(int size)
public long getMaxBundleTimeout()
public void setMaxBundleTimeout(long timeout)
public int getMaxBundleSize()
public int getBundlerCapacity()
public int getBundlerBufferSize()
public java.lang.String bundlerWaitStrategy()
public void bundlerWaitStrategy(java.lang.String strategy)
public int bundlerNumSpins()
public void bundlerNumSpins(int spins)
public boolean isLogicalAddressCacheReaperRunning()
public double getAvgBatchSize()
public void setOOBThreadPoolKeepAliveTime(long time)
public long getOOBThreadPoolKeepAliveTime()
public void setOOBThreadPoolMinThreads(int size)
public int getOOBThreadPoolMinThreads()
public void setOOBThreadPoolMaxThreads(int size)
public int getOOBThreadPoolMaxThreads()
public void setOOBThreadPoolQueueEnabled(boolean flag)
public void setThreadPoolMinThreads(int size)
public int getThreadPoolMinThreads()
public void setThreadPoolMaxThreads(int size)
public int getThreadPoolMaxThreads()
public void setThreadPoolKeepAliveTime(long time)
public long getThreadPoolKeepAliveTime()
public void setTimerMinThreads(int size)
public int getTimerMinThreads()
public void setTimerMaxThreads(int size)
public int getTimerMaxThreads()
public void setTimerKeepAliveTime(long time)
public long getTimerKeepAliveTime()
public int getTimerQueueSize()
public java.lang.String getTimerClass()
public java.lang.String getClusterName()
public AsciiString getClusterNameAscii()
public int getDifferentClusterMessages()
public int getDifferentVersionMessages()
public void clearDifferentClusterCache()
public void clearDifferentVersionCache()
public static java.lang.String loggerType()
public abstract boolean supportsMulticasting()
public boolean isMulticastCapable()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getLocalAddress()
public Address localAddress()
public View view()
public java.lang.String getLocalPhysicalAddress()
public void resetStats()
resetStats
in class Protocol
public void registerProbeHandler(DiagnosticsHandler.ProbeHandler handler)
public void unregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)
public void setDiagnosticsHandler(DiagnosticsHandler handler)
DiagnosticsHandler
. Should be set before the stack is startedhandler
- public Bundler getBundler()
public void setBundler(Bundler bundler)
public void setThreadPoolQueueEnabled(boolean flag)
public java.util.concurrent.Executor getDefaultThreadPool()
public void setDefaultThreadPool(java.util.concurrent.Executor thread_pool)
public ThreadFactory getDefaultThreadPoolThreadFactory()
public void setDefaultThreadPoolThreadFactory(ThreadFactory factory)
public java.util.concurrent.Executor getOOBThreadPool()
public void setOOBThreadPool(java.util.concurrent.Executor oob_thread_pool)
public ThreadFactory getOOBThreadPoolThreadFactory()
public void setOOBThreadPoolThreadFactory(ThreadFactory factory)
public java.util.concurrent.Executor getInternalThreadPool()
public void setInternalThreadPool(java.util.concurrent.Executor internal_thread_pool)
public ThreadFactory getInternalThreadPoolThreadFactory()
public void setInternalThreadPoolThreadFactory(ThreadFactory factory)
public ThreadFactory getTimerThreadFactory()
public void setTimerThreadFactory(ThreadFactory factory)
public TimeScheduler getTimer()
public void setTimer(TimeScheduler timer)
timer
- public TimeService getTimeService()
public void setTimeService(TimeService ts)
public ThreadFactory getThreadFactory()
Protocol
getThreadFactory
in class Protocol
public void setThreadFactory(ThreadFactory factory)
public SocketFactory getSocketFactory()
Protocol
getSocketFactory
in class Protocol
public void setSocketFactory(SocketFactory factory)
Protocol
TP
)
or TP.ProtocolAdapter
setSocketFactory
in class Protocol
public java.lang.String getThreadNamingPattern()
public long getNumMessagesSent()
public long getNumMessagesReceived()
public long getNumBytesSent()
public long getNumBytesReceived()
public void incrBatchesSent()
public void incrBatchesSent(int delta)
public void incrSingleMsgsInsteadOfBatches()
public java.net.InetAddress getBindAddress()
public TP setBindAddress(java.net.InetAddress bind_addr)
public int getBindPort()
public void setBindPort(int port)
public void setBindToAllInterfaces(boolean flag)
public boolean isReceiveOnAllInterfaces()
public java.util.List<java.net.NetworkInterface> getReceiveInterfaces()
@Deprecated public static boolean isDiscardIncompatiblePackets()
@Deprecated public static void setDiscardIncompatiblePackets(boolean flag)
@Deprecated public static boolean isEnableBundling()
@Deprecated public void setEnableBundling(boolean flag)
@Deprecated public static boolean isEnableUnicastBundling()
@Deprecated public void setEnableUnicastBundling(boolean enable_unicast_bundling)
public void setPortRange(int range)
public int getPortRange()
public boolean isOOBThreadPoolEnabled()
public boolean isDefaulThreadPoolEnabled()
@Deprecated public boolean isLoopback()
@Deprecated public void setLoopback(boolean b)
public java.util.concurrent.ConcurrentMap<AsciiString,Protocol> getUpProtocols()
public int getOOBPoolSize()
public int getOOBPoolSizeActive()
public long getOOBMessages()
public int getOOBQueueSize()
public int getOOBMaxQueueSize()
public void setOOBRejectionPolicy(java.lang.String rejection_policy)
public int getRegularPoolSize()
public int getRegularPoolSizeActive()
public long getRegularMessages()
public int getRegularQueueSize()
public int getRegularMaxQueueSize()
public int getInternalPoolSize()
public int getInternalPoolSizeActive()
public long getInternalMessages()
public int getInternalQueueSize()
public int getInternalMaxQueueSize()
public int getNumTimerTasks()
public java.lang.String dumpTimerTasks()
public int getTimerThreads()
public static int getNumThreads()
public boolean isDiagnosticsHandlerRunning()
public void setRegularRejectionPolicy(java.lang.String rejection_policy)
public void setLogDiscardMessages(boolean flag)
public boolean getLogDiscardMessages()
public void setLogDiscardMessagesVersion(boolean flag)
public boolean getLogDiscardMessagesVersion()
public java.lang.String printLogicalAddressCache()
public java.lang.String printWhoHasCache()
public void evictLogicalAddressCache()
public void evictLogicalAddressCache(boolean force)
public abstract void sendMulticast(AsciiString cluster_name, byte[] data, int offset, int length) throws java.lang.Exception
cluster_name
- The name of the cluster. Null if not a shared transportdata
- The data to be sent. This is not a copy, so don't modify itoffset
- length
- java.lang.Exception
public abstract void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws java.lang.Exception
dest
- Must be a non-null unicast addressdata
- The data to be sent. This is not a copy, so don't modify itoffset
- length
- java.lang.Exception
public abstract java.lang.String getInfo()
public void init() throws java.lang.Exception
Protocol
public void destroy()
Protocol
Channel.close()
.
Does some cleanup; after the call the VM will terminatepublic void start() throws java.lang.Exception
start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void bundler(java.lang.String type)
public void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedpublic void enableDiagnostics()
public void disableDiagnostics()
protected void startDiagnostics() throws java.lang.Exception
java.lang.Exception
protected void stopDiagnostics()
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
DiagnosticsHandler.ProbeHandler
handleProbe
in interface DiagnosticsHandler.ProbeHandler
public java.lang.String[] supportedKeys()
DiagnosticsHandler.ProbeHandler
supportedKeys
in interface DiagnosticsHandler.ProbeHandler
protected void handleConnect() throws java.lang.Exception
java.lang.Exception
protected void handleDisconnect()
public java.lang.String getSingletonName()
public boolean isSingleton()
public java.lang.Object up(Event evt)
public java.lang.Object down(Event evt)
protected Bundler createBundler(java.lang.String type)
protected void loopback(Message msg, boolean multicast)
protected void setSourceAddress(Message msg)
protected void passMessageUp(Message msg, AsciiString cluster_name, boolean perform_cluster_name_matching, boolean multicast, boolean discard_own_mcast)
protected void passBatchUp(MessageBatch batch, boolean perform_cluster_name_matching, boolean discard_own_mcast)
public void receive(Address sender, byte[] data, int offset, int length)
protected void handleMessageBatch(Address sender, byte[] data, int offset, int length)
protected void handleSingleMessage(Address sender, byte[] data, int offset, int length)
protected void removeAndDispatchNonBundledMessages(MessageBatch... oob_batches)
protected java.util.concurrent.Executor pickThreadPool(boolean oob, boolean internal)
protected boolean versionMatch(short version, Address sender)
protected void send(Message msg, Address dest) throws java.lang.Exception
java.lang.Exception
protected void doSend(AsciiString cluster_name, byte[] buf, int offset, int length, Address dest) throws java.lang.Exception
java.lang.Exception
protected void sendToSingleMember(Address dest, byte[] buf, int offset, int length) throws java.lang.Exception
java.lang.Exception
protected void sendToMembers(java.util.Collection<Address> mbrs, byte[] buf, int offset, int length) throws java.lang.Exception
java.lang.Exception
protected void fetchPhysicalAddrs(java.util.List<Address> missing)
protected Responses fetchResponsesFromDiscoveryProtocol(java.util.List<Address> missing)
protected AsciiString getClusterName(Message msg)
protected void setPingData(PingData data)
protected static void writeMessage(Message msg, java.io.DataOutput dos, boolean multicast) throws java.lang.Exception
msg
- java.io.IOException
java.lang.Exception
public static Message readMessage(java.io.DataInput instream) throws java.lang.Exception
java.lang.Exception
public static void writeMessageList(Address dest, Address src, byte[] cluster_name, java.util.List<Message> msgs, java.io.DataOutput dos, boolean multicast, short transport_id) throws java.lang.Exception
List: * | version | flags | dest | src | cluster-name | [Message*] | Message: | presence | leading | flags | [src] | length | [buffer] | size | [Headers*] |
dest
- src
- msgs
- dos
- multicast
- java.lang.Exception
public static void writeMessageListHeader(Address dest, Address src, byte[] cluster_name, int numMsgs, java.io.DataOutput dos, boolean multicast) throws java.lang.Exception
java.lang.Exception
public static java.util.List<Message> readMessageList(java.io.DataInput in, short transport_id) throws java.lang.Exception
java.lang.Exception
public static MessageBatch[] readMessageBatch(java.io.DataInput in, boolean multicast) throws java.lang.Exception
in
- java.lang.Exception
protected java.lang.Object handleDownEvent(Event evt)
protected void registerLocalAddress(Address addr)
addr
- protected void fetchLocalAddresses()
protected void setThreadNames()
protected void unsetThreadNames()
protected void setInAllThreadFactories(java.lang.String cluster_name, Address local_address, java.lang.String pattern)
protected static java.util.concurrent.ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, java.lang.String rejection_policy, java.util.concurrent.BlockingQueue<java.lang.Runnable> queue, ThreadFactory factory)
protected static void shutdownThreadPool(java.util.concurrent.Executor thread_pool)
protected void passToAllUpProtocols(Event evt)
protected boolean addPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr)
protected PhysicalAddress getPhysicalAddressFromCache(Address logical_addr)
protected java.util.Collection<PhysicalAddress> getAllPhysicalAddressesFromCache()
protected void removeLogicalAddressFromCache(Address logical_addr)
public void clearLogicalAddressCache()
protected abstract PhysicalAddress getPhysicalAddress()
protected static int assertPositive(int value, java.lang.String message)
Copyright © 1998-2020 Red Hat. All Rights Reserved.