org.jgroups.protocols
Class BasicTCP

java.lang.Object
  extended by org.jgroups.stack.Protocol
      extended by org.jgroups.protocols.TP
          extended by org.jgroups.protocols.BasicTCP
Direct Known Subclasses:
TCP, TCP_NIO

public abstract class BasicTCP
extends TP

Shared base class for TCP protocols

Author:
Scott Marlow, Bela Ban

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgroups.protocols.TP
TP.Bundler, TP.DefaultBundler, TP.DefaultBundler2, TP.ProtocolAdapter, TP.TransferQueueBundler, TP.TransferQueueBundler2
 
Field Summary
protected  java.net.InetAddress client_bind_addr
           
protected  int client_bind_port
           
protected  long conn_expire_time
           
protected  boolean defer_client_bind_addr
           
protected  int linger
           
protected  int peer_addr_read_timeout
           
protected  long reaper_interval
           
protected  int recv_buf_size
           
protected  int send_buf_size
           
protected  int send_queue_size
           
protected  int sock_conn_timeout
           
protected  boolean tcp_nodelay
           
protected  boolean use_send_queues
           
 
Fields inherited from class org.jgroups.protocols.TP
bind_addr, bind_interface_str, bind_port, bundler, bundler_capacity, bundler_type, can_bind_to_mcast_addr, channel_name, connect_count, connectLock, default_thread_factory, diag_handler, diagnostics_addr, diagnostics_bind_interfaces, diagnostics_passcode, diagnostics_port, diagnostics_ttl, discard_incompatible_packets, enable_bundling, enable_diagnostics, enable_unicast_bundling, external_addr, external_port, f, global_thread_factory, header, last_discovery_request, LIST, local_addr, log_discard_msgs, log_discard_msgs_version, logical_addr_cache, logical_addr_cache_expiration, logical_addr_cache_max_size, loopback, max_bundle_size, max_bundle_timeout, members, MULTICAST, num_bytes_received, num_bytes_sent, num_incoming_msgs_received, num_msgs_received, num_msgs_sent, num_oob_msgs_received, OOB, oob_thread_factory, oob_thread_pool, oob_thread_pool_enabled, oob_thread_pool_keep_alive_time, oob_thread_pool_max_threads, oob_thread_pool_min_threads, oob_thread_pool_queue, oob_thread_pool_queue_enabled, oob_thread_pool_queue_max_size, physical_addr_max_fetch_attempts, port_range, preregistered_probe_handlers, print_function, receive_interfaces, receive_on_all_interfaces, singleton_name, socket_factory, suppress_log_different_cluster, suppress_log_different_version, suppress_time_different_cluster_warnings, suppress_time_different_version_warnings, thread_naming_pattern, thread_pool, thread_pool_enabled, thread_pool_keep_alive_time, thread_pool_max_threads, thread_pool_min_threads, thread_pool_queue, thread_pool_queue_enabled, thread_pool_queue_max_size, thread_pool_rejection_policy, tick_time, timer, timer_keep_alive_time, timer_max_threads, timer_min_threads, timer_queue_max_size, timer_rejection_policy, timer_thread_factory, timer_type, up_prots, wheel_size, who_has_cache, who_has_cache_timeout
 
Fields inherited from class org.jgroups.stack.Protocol
down_prot, ergonomics, id, log, name, stack, stats, up_prot
 
Constructor Summary
protected BasicTCP()
           
 
Method Summary
 long getConnExpireTime()
           
 java.lang.String getInfo()
           
 long getReaperInterval()
           
protected  java.lang.Object handleDownEvent(Event evt)
           
 void init()
          Called after instance has been created (null constructor) and before protocol is started.
abstract  java.lang.String printConnections()
           
 void receive(Address sender, byte[] data, int offset, int length)
          ConnectionMap.Receiver interface
abstract  void retainAll(java.util.Collection<Address> members)
           
abstract  void send(Address dest, byte[] data, int offset, int length)
           
 void sendMulticast(byte[] data, int offset, int length)
          Send to all members in the group.
 void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)
          Send a unicast to 1 member.
 void setConnExpireTime(long conn_expire_time)
           
 void setReaperInterval(long reaper_interval)
           
 boolean supportsMulticasting()
          Whether or not hardware multicasting is supported
 
Methods inherited from class org.jgroups.protocols.TP
addPhysicalAddressToCache, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createThreadPool, destroy, dispatchToThreadPool, doSend, down, dumpTimerTasks, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, getAllPhysicalAddressesFromCache, getBindAddress, getBindPort, getBundlerBufferSize, getDefaultThreadPool, getDefaultThreadPoolThreadFactory, getDifferentClusterMessages, getDifferentVersionMessages, getLogDiscardMessages, getLogDiscardMessagesVersion, getMaxBundleSize, getMaxBundleTimeout, getNumBytesReceived, getNumBytesSent, getNumMessagesReceived, getNumMessagesSent, getNumThreads, getNumTimerTasks, getOOBMaxQueueSize, getOOBMessages, getOOBPoolSize, getOOBQueueSize, getOOBThreadPool, getOOBThreadPoolKeepAliveTime, getOOBThreadPoolMaxThreads, getOOBThreadPoolMinThreads, getOOBThreadPoolThreadFactory, getPhysicalAddress, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getRegularMaxQueueSize, getRegularMessages, getRegularPoolSize, getRegularQueueSize, getSingletonName, getSocketFactory, getThreadFactory, getThreadNamingPattern, getThreadPoolKeepAliveTime, getThreadPoolMaxThreads, getThreadPoolMinThreads, getTimer, getTimerClass, getTimerKeepAliveTime, getTimerMaxThreads, getTimerMinThreads, getTimerQueueSize, getTimerThreadFactory, getTimerThreads, getUpProtocols, handleConnect, handleDisconnect, isDefaulThreadPoolEnabled, isDiscardIncompatiblePackets, isEnableBundling, isEnableUnicastBundling, isLoopback, isMulticastCapable, isOOBThreadPoolEnabled, isReceiveOnAllInterfaces, isSingleton, passMessageUp, passToAllUpProtocols, printLogicalAddressCache, printWhoHasCache, readMessage, readMessageList, registerLocalAddress, registerProbeHandler, removeLogicalAddressFromCache, resetStats, send, sendToAllPhysicalAddresses, sendToSingleMember, setBindAddress, setBindPort, setBindToAllInterfaces, setDefaultThreadPool, setDefaultThreadPoolThreadFactory, setDiagnosticsHandler, setDiscardIncompatiblePackets, setEnableBundling, setEnableUnicastBundling, setInAllThreadFactories, setLogDiscardMessages, setLogDiscardMessagesVersion, setLoopback, setMaxBundleSize, setMaxBundleTimeout, setOOBRejectionPolicy, setOOBThreadPool, setOOBThreadPoolKeepAliveTime, setOOBThreadPoolMaxThreads, setOOBThreadPoolMinThreads, setOOBThreadPoolThreadFactory, setPortRange, setRegularRejectionPolicy, setSocketFactory, setSourceAddress, setThreadFactory, setThreadNames, setThreadPoolKeepAliveTime, setThreadPoolMaxThreads, setThreadPoolMinThreads, setThreadPoolQueueEnabled, setTimer, setTimerKeepAliveTime, setTimerMaxThreads, setTimerMinThreads, setTimerThreadFactory, shutdownThreadPool, start, stop, toString, unregisterProbeHandler, unsetThreadNames, up, writeMessage, writeMessageList
 
Methods inherited from class org.jgroups.stack.Protocol
dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setUpProtocol, setValue, setValues, statsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reaper_interval

protected long reaper_interval

conn_expire_time

protected long conn_expire_time

use_send_queues

protected boolean use_send_queues

send_queue_size

protected int send_queue_size

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

tcp_nodelay

protected boolean tcp_nodelay

linger

protected int linger

client_bind_addr

protected java.net.InetAddress client_bind_addr

client_bind_port

protected int client_bind_port

defer_client_bind_addr

protected boolean defer_client_bind_addr
Constructor Detail

BasicTCP

protected BasicTCP()
Method Detail

supportsMulticasting

public boolean supportsMulticasting()
Description copied from class: TP
Whether or not hardware multicasting is supported

Specified by:
supportsMulticasting in class TP

getReaperInterval

public long getReaperInterval()

setReaperInterval

public void setReaperInterval(long reaper_interval)

getConnExpireTime

public long getConnExpireTime()

setConnExpireTime

public void setConnExpireTime(long conn_expire_time)

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

sendMulticast

public void sendMulticast(byte[] data,
                          int offset,
                          int length)
                   throws java.lang.Exception
Description copied from class: TP
Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member

Specified by:
sendMulticast in class TP
Parameters:
data - The data to be sent. This is not a copy, so don't modify it
Throws:
java.lang.Exception

sendUnicast

public void sendUnicast(PhysicalAddress dest,
                        byte[] data,
                        int offset,
                        int length)
                 throws java.lang.Exception
Description copied from class: TP
Send a unicast to 1 member. Note that the destination address is a *physical*, not a logical address

Specified by:
sendUnicast in class TP
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
Throws:
java.lang.Exception

getInfo

public java.lang.String getInfo()
Specified by:
getInfo in class TP

printConnections

public abstract java.lang.String printConnections()

send

public abstract void send(Address dest,
                          byte[] data,
                          int offset,
                          int length)
                   throws java.lang.Exception
Throws:
java.lang.Exception

retainAll

public abstract void retainAll(java.util.Collection<Address> members)

receive

public void receive(Address sender,
                    byte[] data,
                    int offset,
                    int length)
ConnectionMap.Receiver interface

Overrides:
receive in class TP

handleDownEvent

protected java.lang.Object handleDownEvent(Event evt)
Overrides:
handleDownEvent in class TP


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.