org.jgroups.protocols

## Class TP

- java.lang.Object
- - org.jgroups.stack.Protocol
  - - org.jgroups.protocols.TP

Direct Known Subclasses:
  BasicTCP, LOOPBACK, SHARED_LOOPBACK, TUNNEL, UDP

    public abstract class TP
    extends Protocol

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
- loopback

A subclass has to override

- `sendMulticast(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()`

The create() or start() method has to create a local address.
The `receive(Address, byte[], int, int)` method must be called by subclasses when a unicast or multicast message has been received.

Author:
  Bela Ban

### Nested Class Summary

Nested Classes
`protected static interface` `TP.Bundler`
`protected class` `TP.DiagnosticsHandler`
`static interface` `TP.ProbeHandler`
`static class` `TP.ProtocolAdapter` Used when the transport is shared (singleton_name is not null).

### Field Summary

Fields
`protected java.net.InetAddress` `bind_addr`
`protected java.lang.String` `bind_interface_str`
`protected int` `bind_port` The port to which the transport binds.
`protected TP.Bundler` `bundler`
`protected int` `bundler_capacity`
`protected java.lang.String` `bundler_type`
`protected static boolean` `can_bind_to_mcast_addr`
`protected java.lang.String` `channel_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 TP.DiagnosticsHandler` `diag_handler`
`protected java.net.InetAddress` `diagnostics_addr`
`protected int` `diagnostics_port`
`protected boolean` `discard_incompatible_packets` Discard packets with a different version.
`protected boolean` `enable_bundling`
`protected boolean` `enable_diagnostics`
`protected boolean` `enable_unicast_bundling` Enable bundling for unicast messages.
`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 long` `last_discovery_request`
`protected static byte` `LIST`
`protected Address` `local_addr` The address (host and port) of this member.
`protected boolean` `log_discard_msgs` Whether or not warnings about messages from different groups are logged - private flag, not for common use
`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 boolean` `loopback` If true, messages sent to self are treated specially: unicast messages are looped back immediately, multicast messages get a local copy first and - when the real copy arrives - it will be discarded.
`protected int` `max_bundle_size` Maximum number of bytes for messages to be queued until they are sent.
`protected long` `max_bundle_timeout` Max number of milliseconds until queued messages are sent.
`protected java.util.Set<Address>` `members` The members of this group (updated when a member joins or leaves).
`protected static byte` `MULTICAST`
`protected long` `num_bytes_received`
`protected long` `num_bytes_sent`
`protected long` `num_incoming_msgs_received`
`protected long` `num_msgs_received`
`protected long` `num_msgs_sent`
`protected long` `num_oob_msgs_received`
`protected static byte` `OOB`
`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`
`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.ThreadGroup` `pool_thread_group`
`protected int` `port_range`
`protected java.util.List<TP.ProbeHandler>` `preregistered_probe_handlers`
`protected static LazyRemovalCache.Printable<Address,PhysicalAddress>` `print_function`
`protected java.util.List<java.net.NetworkInterface>` `receive_interfaces` List<NetworkInterface> of interfaces to receive multicasts on.
`protected boolean` `receive_on_all_interfaces`
`protected java.lang.String` `singleton_name`
`protected SocketFactory` `socket_factory`
`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`
`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 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 ThreadFactory` `timer_thread_factory`
`protected java.lang.String` `timer_type`
`protected java.util.concurrent.ConcurrentMap<java.lang.String,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 int` `wheel_size`
`protected AgeOutCache<Address>` `who_has_cache` Cache keeping track of WHO_HAS requests for physical addresses (given a logical address) and expiring them after 5000ms

### Fields inherited from class org.jgroups.stack.Protocol

`down_prot, ergonomics, id, log, name, stack, stats, up_prot`

### Constructor Summary

Constructors
`protected` `TP()` Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads.

### Method Summary

Methods
`protected void` `addPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr)`
`void` `clearLogicalAddressCache()` Clears the cache.
`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()`.
`protected void` `dispatchToThreadPool(java.util.concurrent.Executor pool, Address sender, byte[] data, int offset, int length)`
`protected void` `doSend(Buffer buf, Address dest, boolean multicast)`
`java.lang.Object` `down(Event evt)` Caller by the layer above this layer.
`java.lang.String` `dumpTimerTasks()`
`void` `evictLogicalAddressCache()`
`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
`java.lang.String` `getBindAddress()`
`java.net.InetAddress` `getBindAddressAsInetAddress()`
`int` `getBindPort()`
`boolean` `getBindToAllInterfaces()` Deprecated. Use `isReceiveOnAllInterfaces()` instead
`int` `getBundlerBufferSize()`
`java.util.concurrent.Executor` `getDefaultThreadPool()`
`ThreadFactory` `getDefaultThreadPoolThreadFactory()`
`abstract java.lang.String` `getInfo()`
`boolean` `getLogDiscardMessages()`
`int` `getMaxBundleSize()`
`long` `getMaxBundleTimeout()`
`long` `getNumBytesReceived()`
`long` `getNumBytesSent()`
`long` `getNumMessagesReceived()`
`long` `getNumMessagesSent()`
`int` `getNumTimerTasks()`
`int` `getOOBMaxQueueSize()`
`long` `getOOBMessages()`
`int` `getOOBPoolSize()`
`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)`
`java.lang.ThreadGroup` `getPoolThreadGroup()`
`int` `getPortRange()`
`java.util.List<java.net.NetworkInterface>` `getReceiveInterfaces()`
`int` `getRegularMaxQueueSize()`
`long` `getRegularMessages()`
`int` `getRegularPoolSize()`
`int` `getRegularQueueSize()`
`static java.util.List<java.net.NetworkInterface>` `getSendInterfaces()` Deprecated. This property was removed in 2.7
`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()`
`java.util.concurrent.ConcurrentMap<java.lang.String,Protocol>` `getUpProtocols()`
`protected void` `handleConnect()`
`protected void` `handleDisconnect()`
`protected java.lang.Object` `handleDownEvent(Event evt)`
`void` `init()` Called after instance has been created (null constructor) and before protocol is started.
`boolean` `isDefaulThreadPoolEnabled()`
`boolean` `isDiscardIncompatiblePackets()`
`boolean` `isEnableBundling()`
`boolean` `isEnableUnicastBundling()`
`boolean` `isLoopback()`
`boolean` `isOOBThreadPoolEnabled()`
`boolean` `isReceiveOnAllInterfaces()`
`static boolean` `isSendOnAllInterfaces()` Deprecated. This property was removed in 2.7
`boolean` `isSingleton()`
`static boolean` `isUseIncomingPacketHandler()` Deprecated. With the concurrent stack being the default, this property is ignored
`protected static java.util.concurrent.RejectedExecutionHandler` `parseRejectionPolicy(java.lang.String rejection_policy)`
`protected void` `passMessageUp(Message msg, boolean perform_cluster_name_matching, boolean multicast, boolean discard_own_mcast)`
`protected void` `passToAllUpProtocols(Event evt)`
`java.lang.String` `printLogicalAddressCache()`
`protected static Message` `readMessage(java.io.DataInputStream instream)`
`protected static java.util.List<Message>` `readMessageList(java.io.DataInputStream in)`
`protected 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(TP.ProbeHandler handler)`
`protected void` `removeLogicalAddressFromCache(Address logical_addr)`
`void` `resetStats()`
`protected void` `send(Message msg, Address dest, boolean multicast)` Serializes and sends a message.
`abstract void` `sendMulticast(byte[] data, int offset, int length)` Send to all members in the group.
`protected void` `sendToAllPhysicalAddresses(byte[] buf, int offset, int length)`
`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.
`void` `setBindAddress(java.lang.String bind_addr)`
`void` `setBindPort(int port)`
`void` `setBindToAllInterfaces(boolean flag)`
`void` `setDefaultThreadPool(java.util.concurrent.Executor thread_pool)`
`void` `setDefaultThreadPoolThreadFactory(ThreadFactory factory)`
`void` `setDiscardIncompatiblePackets(boolean flag)`
`void` `setEnableBundling(boolean flag)`
`void` `setEnableUnicastBundling(boolean enable_unicast_bundling)`
`protected void` `setInAllThreadFactories(java.lang.String cluster_name, Address local_address, java.lang.String pattern)`
`void` `setLogDiscardMessages(boolean flag)`
`void` `setLoopback(boolean b)`
`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` `setOOBThreadPoolThreadFactory(ThreadFactory factory)`
`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` `setTimerKeepAliveTime(long time)`
`void` `setTimerMaxThreads(int size)`
`void` `setTimerMinThreads(int size)`
`void` `setTimerThreadFactory(ThreadFactory factory)`
`void` `setUseConcurrentStack(boolean flag)` Deprecated. the concurrent stack is used by default
`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
`void` `stop()` This method is called on a `Channel.disconnect()`.
`abstract boolean` `supportsMulticasting()` Whether or not hardware multicasting is supported
`java.lang.String` `toString()`
`void` `unregisterProbeHandler(TP.ProbeHandler handler)`
`protected void` `unsetThreadNames()`
`java.lang.Object` `up(Event evt)` handle the UP event.
`protected void` `verifyRejectionPolicy(java.lang.String str)`
`protected static void` `writeMessage(Message msg, java.io.DataOutputStream dos, boolean multicast)` This method needs to be synchronized on out_stream when it is called
`protected static void` `writeMessageList(Address dest, Address src, java.util.List<Message> msgs, java.io.DataOutputStream dos, boolean multicast)` Write a lits of messages with the same destination and *mostly* the same src addresses.

### Methods inherited from class org.jgroups.stack.Protocol

`downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### LIST

    protected static final byte LIST

See Also:
  Constant Field Values

#### MULTICAST

    protected static final byte MULTICAST

See Also:
  Constant Field Values

#### OOB

    protected static final byte OOB

See Also:
  Constant Field Values

#### can_bind_to_mcast_addr

    protected static final boolean can_bind_to_mcast_addr

#### f

    protected static java.text.NumberFormat f

#### bind_addr

    protected java.net.InetAddress bind_addr

#### bind_interface_str

    protected java.lang.String bind_interface_str

#### receive_on_all_interfaces

    protected boolean receive_on_all_interfaces

#### receive_interfaces

    protected java.util.List<java.net.NetworkInterface> receive_interfaces

List<NetworkInterface> of 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

#### bind_port

    protected int bind_port

The port to which the transport binds. 0 means to bind to any (ephemeral) port

#### port_range

    protected int port_range

#### loopback

    protected boolean loopback

If true, messages sent to self are treated specially: unicast messages are looped back immediately, multicast messages get a local copy first and - when the real copy arrives - it will be discarded. Useful for Window media (non)sense

#### discard_incompatible_packets

    protected boolean discard_incompatible_packets

Discard packets with a different version. Usually minor version differences are okay. Setting this property to true means that we expect the exact same version on all incoming packets

#### thread_naming_pattern

    protected java.lang.String thread_naming_pattern

#### oob_thread_pool_enabled

    protected boolean oob_thread_pool_enabled

#### oob_thread_pool_min_threads

    protected int oob_thread_pool_min_threads

#### oob_thread_pool_max_threads

    protected int oob_thread_pool_max_threads

#### oob_thread_pool_keep_alive_time

    protected long oob_thread_pool_keep_alive_time

#### oob_thread_pool_queue_enabled

    protected boolean oob_thread_pool_queue_enabled

#### oob_thread_pool_queue_max_size

    protected int oob_thread_pool_queue_max_size

#### thread_pool_min_threads

    protected int thread_pool_min_threads

#### thread_pool_max_threads

    protected int thread_pool_max_threads

#### thread_pool_keep_alive_time

    protected long thread_pool_keep_alive_time

#### thread_pool_enabled

    protected boolean thread_pool_enabled

#### thread_pool_queue_enabled

    protected boolean thread_pool_queue_enabled

#### thread_pool_queue_max_size

    protected int thread_pool_queue_max_size

#### thread_pool_rejection_policy

    protected java.lang.String thread_pool_rejection_policy

#### timer_type

    protected java.lang.String timer_type

#### timer_min_threads

    protected int timer_min_threads

#### timer_max_threads

    protected int timer_max_threads

#### timer_keep_alive_time

    protected long timer_keep_alive_time

#### timer_queue_max_size

    protected int timer_queue_max_size

#### wheel_size

    protected int wheel_size

#### tick_time

    protected long tick_time

#### enable_bundling

    protected boolean enable_bundling

#### enable_unicast_bundling

    protected boolean enable_unicast_bundling

Enable bundling for unicast messages. Ignored if enable_bundling is off

#### enable_diagnostics

    protected boolean enable_diagnostics

#### diagnostics_addr

    protected java.net.InetAddress diagnostics_addr

#### diagnostics_port

    protected int diagnostics_port

#### singleton_name

    protected java.lang.String singleton_name

#### log_discard_msgs

    protected boolean log_discard_msgs

Whether or not warnings about messages from different groups are logged - private flag, not for common use

#### max_bundle_size

    protected int max_bundle_size

Maximum number of bytes for messages to be queued until they are sent. This value needs to be smaller than the largest datagram packet size in case of UDP

#### max_bundle_timeout

    protected long max_bundle_timeout

Max number of milliseconds until queued messages are sent. Messages are sent when max_bundle_size or max_bundle_timeout has been exceeded (whichever occurs faster)

#### bundler_type

    protected java.lang.String bundler_type

#### bundler_capacity

    protected int bundler_capacity

#### num_msgs_sent

    protected long num_msgs_sent

#### num_msgs_received

    protected long num_msgs_received

#### num_bytes_sent

    protected long num_bytes_sent

#### num_bytes_received

    protected long num_bytes_received

#### channel_name

    protected java.lang.String channel_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

#### num_oob_msgs_received

    protected long num_oob_msgs_received

#### num_incoming_msgs_received

    protected long num_incoming_msgs_received

#### local_addr

    protected Address local_addr

The address (host and port) of this member. Null by default when a shared transport is used

#### 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

#### pool_thread_group

    protected java.lang.ThreadGroup pool_thread_group

#### connect_count

    protected int connect_count

Keeps track of connects and disconnects, in order to start and stop threads

#### connectLock

    protected final java.util.concurrent.locks.ReentrantLock connectLock

#### oob_thread_pool

    protected java.util.concurrent.Executor oob_thread_pool

#### oob_thread_factory

    protected ThreadFactory oob_thread_factory

Factory which is used by oob_thread_pool

#### oob_thread_pool_queue

    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

#### thread_pool

    protected java.util.concurrent.Executor thread_pool

The thread pool which handles unmarshalling, version checks and dispatching of regular messages

#### default_thread_factory

    protected ThreadFactory default_thread_factory

Factory which is used by oob_thread_pool

#### thread_pool_queue

    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

#### timer

    protected TimeScheduler timer

#### timer_thread_factory

    protected ThreadFactory timer_thread_factory

#### global_thread_factory

    protected ThreadFactory global_thread_factory

Used by all threads created by JGroups outside of the thread pools

#### socket_factory

    protected SocketFactory socket_factory

#### bundler

    protected TP.Bundler bundler

#### diag_handler

    protected TP.DiagnosticsHandler diag_handler

#### preregistered_probe_handlers

    protected final java.util.List<TP.ProbeHandler> preregistered_probe_handlers

#### up_prots

    protected final java.util.concurrent.ConcurrentMap<java.lang.String,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). The values are the next protocols above the transports.

#### header

    protected TpHeader header

The header including the cluster name, sent with each message. Not used with a shared transport (instead TP.ProtocolAdapter attaches the header to the 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

#### print_function

    protected static final LazyRemovalCache.Printable<Address,PhysicalAddress> print_function

#### who_has_cache

    protected AgeOutCache<Address> who_has_cache

Cache keeping track of WHO_HAS requests for physical addresses (given a logical address) and expiring them after 5000ms

### Constructor Detail

#### TP

    protected TP()

Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads.

### Method Detail

#### setMaxBundleSize

    public void setMaxBundleSize(int size)

#### getMaxBundleTimeout

    public long getMaxBundleTimeout()

#### setMaxBundleTimeout

    public void setMaxBundleTimeout(long timeout)

#### getMaxBundleSize

    public int getMaxBundleSize()

#### getBundlerBufferSize

    public int getBundlerBufferSize()

#### setOOBThreadPoolKeepAliveTime

    public void setOOBThreadPoolKeepAliveTime(long time)

#### getOOBThreadPoolKeepAliveTime

    public long getOOBThreadPoolKeepAliveTime()

#### setOOBThreadPoolMinThreads

    public void setOOBThreadPoolMinThreads(int size)

#### getOOBThreadPoolMinThreads

    public int getOOBThreadPoolMinThreads()

#### setOOBThreadPoolMaxThreads

    public void setOOBThreadPoolMaxThreads(int size)

#### getOOBThreadPoolMaxThreads

    public int getOOBThreadPoolMaxThreads()

#### setThreadPoolMinThreads

    public void setThreadPoolMinThreads(int size)

#### getThreadPoolMinThreads

    public int getThreadPoolMinThreads()

#### setThreadPoolMaxThreads

    public void setThreadPoolMaxThreads(int size)

#### getThreadPoolMaxThreads

    public int getThreadPoolMaxThreads()

#### setThreadPoolKeepAliveTime

    public void setThreadPoolKeepAliveTime(long time)

#### getThreadPoolKeepAliveTime

    public long getThreadPoolKeepAliveTime()

#### setTimerMinThreads

    public void setTimerMinThreads(int size)

#### getTimerMinThreads

    public int getTimerMinThreads()

#### setTimerMaxThreads

    public void setTimerMaxThreads(int size)

#### getTimerMaxThreads

    public int getTimerMaxThreads()

#### setTimerKeepAliveTime

    public void setTimerKeepAliveTime(long time)

#### getTimerKeepAliveTime

    public long getTimerKeepAliveTime()

#### getTimerQueueSize

    public int getTimerQueueSize()

#### getTimerClass

    public java.lang.String getTimerClass()

#### supportsMulticasting

    public abstract boolean supportsMulticasting()

Whether or not hardware multicasting is supported

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### resetStats

    public void resetStats()

Overrides:
  `resetStats` in class `Protocol`

#### registerProbeHandler

    public void registerProbeHandler(TP.ProbeHandler handler)

#### unregisterProbeHandler

    public void unregisterProbeHandler(TP.ProbeHandler handler)

#### getPoolThreadGroup

    public java.lang.ThreadGroup getPoolThreadGroup()

#### setThreadPoolQueueEnabled

    public void setThreadPoolQueueEnabled(boolean flag)

#### getDefaultThreadPool

    public java.util.concurrent.Executor getDefaultThreadPool()

#### setDefaultThreadPool

    public void setDefaultThreadPool(java.util.concurrent.Executor thread_pool)

#### getDefaultThreadPoolThreadFactory

    public ThreadFactory getDefaultThreadPoolThreadFactory()

#### setDefaultThreadPoolThreadFactory

    public void setDefaultThreadPoolThreadFactory(ThreadFactory factory)

#### getOOBThreadPool

    public java.util.concurrent.Executor getOOBThreadPool()

#### setOOBThreadPool

    public void setOOBThreadPool(java.util.concurrent.Executor oob_thread_pool)

#### getOOBThreadPoolThreadFactory

    public ThreadFactory getOOBThreadPoolThreadFactory()

#### setOOBThreadPoolThreadFactory

    public void setOOBThreadPoolThreadFactory(ThreadFactory factory)

#### getTimerThreadFactory

    public ThreadFactory getTimerThreadFactory()

#### setTimerThreadFactory

    public void setTimerThreadFactory(ThreadFactory factory)

#### getTimer

    public TimeScheduler getTimer()

#### getThreadFactory

    public ThreadFactory getThreadFactory()

Description copied from class: `Protocol`
Supposed 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:
  `getThreadFactory` in class `Protocol`
Returns:

#### setThreadFactory

    public void setThreadFactory(ThreadFactory factory)

#### getSocketFactory

    public SocketFactory getSocketFactory()

Description copied from class: `Protocol`
Returns the SocketFactory associated with this protocol, if overridden in a subclass, or passes the call down

Overrides:
  `getSocketFactory` in class `Protocol`
Returns:
  SocketFactory

#### setSocketFactory

    public void setSocketFactory(SocketFactory factory)

Description copied from class: `Protocol`
Sets a SocketFactory. Socket factories are typically provided by the transport (`TP`) or `TP.ProtocolAdapter`

Overrides:
  `setSocketFactory` in class `Protocol`

#### getThreadNamingPattern

    public java.lang.String getThreadNamingPattern()

Names the current thread. Valid values are "pcl": p: include the previous (original) name, e.g. "Incoming thread-1", "UDP ucast receiver" c: include the cluster name, e.g. "MyCluster" l: include the local address of the current member, e.g. "192.168.5.1:5678"

#### getNumMessagesSent

    public long getNumMessagesSent()

#### getNumMessagesReceived

    public long getNumMessagesReceived()

#### getNumBytesSent

    public long getNumBytesSent()

#### getNumBytesReceived

    public long getNumBytesReceived()

#### getBindAddress

    public java.lang.String getBindAddress()

#### setBindAddress

    public void setBindAddress(java.lang.String bind_addr)
                        throws java.net.UnknownHostException

Throws:
  `java.net.UnknownHostException`

#### getBindAddressAsInetAddress

    public java.net.InetAddress getBindAddressAsInetAddress()

#### getBindPort

    public int getBindPort()

#### setBindPort

    public void setBindPort(int port)

#### getBindToAllInterfaces

    public boolean getBindToAllInterfaces()

Deprecated. Use `isReceiveOnAllInterfaces()` instead

#### setBindToAllInterfaces

    public void setBindToAllInterfaces(boolean flag)

#### isReceiveOnAllInterfaces

    public boolean isReceiveOnAllInterfaces()

#### getReceiveInterfaces

    public java.util.List<java.net.NetworkInterface> getReceiveInterfaces()

#### isSendOnAllInterfaces

    public static boolean isSendOnAllInterfaces()

Deprecated. This property was removed in 2.7

#### getSendInterfaces

    public static java.util.List<java.net.NetworkInterface> getSendInterfaces()

Deprecated. This property was removed in 2.7

#### isDiscardIncompatiblePackets

    public boolean isDiscardIncompatiblePackets()

#### setDiscardIncompatiblePackets

    public void setDiscardIncompatiblePackets(boolean flag)

#### isEnableBundling

    public boolean isEnableBundling()

#### setEnableBundling

    public void setEnableBundling(boolean flag)

#### isEnableUnicastBundling

    public boolean isEnableUnicastBundling()

#### setEnableUnicastBundling

    public void setEnableUnicastBundling(boolean enable_unicast_bundling)

#### setPortRange

    public void setPortRange(int range)

#### getPortRange

    public int getPortRange()

#### setUseConcurrentStack

    @Deprecated
    public void setUseConcurrentStack(boolean flag)

Deprecated. the concurrent stack is used by default

#### isOOBThreadPoolEnabled

    public boolean isOOBThreadPoolEnabled()

#### isDefaulThreadPoolEnabled

    public boolean isDefaulThreadPoolEnabled()

#### isLoopback

    public boolean isLoopback()

#### setLoopback

    public void setLoopback(boolean b)

#### isUseIncomingPacketHandler

    public static boolean isUseIncomingPacketHandler()

Deprecated. With the concurrent stack being the default, this property is ignored

#### getUpProtocols

    public java.util.concurrent.ConcurrentMap<java.lang.String,Protocol> getUpProtocols()

#### getOOBPoolSize

    public int getOOBPoolSize()

#### getOOBMessages

    public long getOOBMessages()

#### getOOBQueueSize

    public int getOOBQueueSize()

#### getOOBMaxQueueSize

    public int getOOBMaxQueueSize()

#### setOOBRejectionPolicy

    public void setOOBRejectionPolicy(java.lang.String rejection_policy)

#### getRegularPoolSize

    public int getRegularPoolSize()

#### getRegularMessages

    public long getRegularMessages()

#### getRegularQueueSize

    public int getRegularQueueSize()

#### getRegularMaxQueueSize

    public int getRegularMaxQueueSize()

#### getNumTimerTasks

    public int getNumTimerTasks()

#### dumpTimerTasks

    public java.lang.String dumpTimerTasks()

#### getTimerThreads

    public int getTimerThreads()

#### setRegularRejectionPolicy

    public void setRegularRejectionPolicy(java.lang.String rejection_policy)

#### setLogDiscardMessages

    public void setLogDiscardMessages(boolean flag)

#### getLogDiscardMessages

    public boolean getLogDiscardMessages()

#### printLogicalAddressCache

    public java.lang.String printLogicalAddressCache()

#### evictLogicalAddressCache

    public void evictLogicalAddressCache()

#### sendMulticast

    public abstract void sendMulticast(byte[] data,
                     int offset,
                     int length)
                                throws java.lang.Exception

Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member

Parameters:
  `data` - The data to be sent. This is not a copy, so don't modify it
  `offset` -
  `length` -
Throws:
  `java.lang.Exception`

#### sendUnicast

    public abstract void sendUnicast(PhysicalAddress dest,
                   byte[] data,
                   int offset,
                   int length)
                              throws java.lang.Exception

Send a unicast to 1 member. Note that the destination address is a *physical*, not a logical address

Parameters:
  `dest` - Must be a non-null unicast address
  `data` - The data to be sent. This is not a copy, so don't modify it
  `offset` -
  `length` -
Throws:
  `java.lang.Exception`

#### getInfo

    public abstract java.lang.String getInfo()

#### init

    public void init()
              throws java.lang.Exception

Description copied from class: `Protocol`
Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.

Overrides:
  `init` in class `Protocol`
Throws:
  `java.lang.Exception` - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception

#### destroy

    public void destroy()

Description copied from class: `Protocol`
This method is called on a `Channel.close()`. Does some cleanup; after the call the VM will terminate

Overrides:
  `destroy` in class `Protocol`

#### start

    public void start()
               throws java.lang.Exception

Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads

Overrides:
  `start` in class `Protocol`
Throws:
  `java.lang.Exception` - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so `Channel.connect(String)` will throw an exception

#### stop

    public void stop()

Description copied from class: `Protocol`
This method is called on a `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 flushed

Overrides:
  `stop` in class `Protocol`

#### handleConnect

    protected void handleConnect()
                          throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### handleDisconnect

    protected void handleDisconnect()

#### getSingletonName

    public java.lang.String getSingletonName()

#### isSingleton

    public boolean isSingleton()

#### up

    public java.lang.Object up(Event evt)

handle the UP event.

Overrides:
  `up` in class `Protocol`
Parameters:
  `evt` - - the event being send from the stack

#### down

    public java.lang.Object down(Event evt)

Caller by the layer above this layer. Usually we just put this Message into the send queue and let one or more worker threads handle it. A worker thread then removes the Message from the send queue, performs a conversion and adds the modified Message to the send queue of the layer below it, by calling down()).

Overrides:
  `down` in class `Protocol`

#### 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 be sending a message on behalf of someone else ! E.g. in case of retransmission, when the original sender has crashed, or in a FLUSH protocol when we have to return all unstable messages with the FLUSH_OK response.

#### passMessageUp

    protected void passMessageUp(Message msg,
                     boolean perform_cluster_name_matching,
                     boolean multicast,
                     boolean discard_own_mcast)

#### receive

    protected void receive(Address sender,
               byte[] data,
               int offset,
               int length)

Subclasses must call this method when a unicast or multicast message has been received. Declared final so subclasses cannot override this method.

Parameters:
  `sender` -
  `data` -
  `offset` -
  `length` -

#### dispatchToThreadPool

    protected void dispatchToThreadPool(java.util.concurrent.Executor pool,
                            Address sender,
                            byte[] data,
                            int offset,
                            int length)

#### send

    protected void send(Message msg,
            Address dest,
            boolean multicast)
                 throws java.lang.Exception

Serializes and sends a message. This method is not reentrant

Throws:
  `java.lang.Exception`

#### doSend

    protected void doSend(Buffer buf,
              Address dest,
              boolean multicast)
                   throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### sendToSingleMember

    protected void sendToSingleMember(Address dest,
                          byte[] buf,
                          int offset,
                          int length)
                               throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### sendToAllPhysicalAddresses

    protected void sendToAllPhysicalAddresses(byte[] buf,
                                  int offset,
                                  int length)
                                       throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### writeMessage

    protected static void writeMessage(Message msg,
                    java.io.DataOutputStream dos,
                    boolean multicast)
                                throws java.lang.Exception

This method needs to be synchronized on out_stream when it is called

Parameters:
  `msg` -
Throws:
  `java.io.IOException`
  `java.lang.Exception`

#### readMessage

    protected static Message readMessage(java.io.DataInputStream instream)
                                  throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### writeMessageList

    protected static void writeMessageList(Address dest,
                        Address src,
                        java.util.List<Message> msgs,
                        java.io.DataOutputStream dos,
                        boolean multicast)
                                    throws java.lang.Exception

Write a lits of messages with the same destination and *mostly* the same src addresses. The message list is marshalled as follows:

     List: * | version | flags | dest | src | [Message*] |

     Message:  | presence | leading | flags | [src] | length | [buffer] | size | [Headers*] |

Parameters:
  `dest` -
  `src` -
  `msgs` -
  `dos` -
  `multicast` -
Throws:
  `java.lang.Exception`

#### readMessageList

    protected static java.util.List<Message> readMessageList(java.io.DataInputStream in)
                                                      throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### handleDownEvent

    protected java.lang.Object handleDownEvent(Event evt)

#### 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)

#### createThreadPool

    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)

#### shutdownThreadPool

    protected static void shutdownThreadPool(java.util.concurrent.Executor thread_pool)

#### verifyRejectionPolicy

    protected void verifyRejectionPolicy(java.lang.String str)
                                  throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### parseRejectionPolicy

    protected static java.util.concurrent.RejectedExecutionHandler parseRejectionPolicy(java.lang.String rejection_policy)

#### passToAllUpProtocols

    protected void passToAllUpProtocols(Event evt)

#### addPhysicalAddressToCache

    protected void addPhysicalAddressToCache(Address logical_addr,
                                 PhysicalAddress physical_addr)

#### getPhysicalAddressFromCache

    protected PhysicalAddress getPhysicalAddressFromCache(Address logical_addr)

#### 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()