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 tcpip protocols

Author:
Scott Marlow

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgroups.protocols.TP
TP.ProbeHandler, TP.ProtocolAdapter
 
Field Summary
protected  long conn_expire_time
           
protected  java.net.InetAddress external_addr
           
protected  long reaper_interval
           
 
Fields inherited from class org.jgroups.protocols.TP
additional_data, bind_addr, bind_port, channel_name, connect_count, connectLock, default_thread_factory, diagnostics_addr, diagnostics_port, dis, discard_incompatible_packets, enable_bundling, enable_diagnostics, enable_unicast_bundling, global_thread_factory, header, in_stream, local_addr, loopback, max_bundle_size, max_bundle_timeout, members, name, num_bytes_received, num_bytes_sent, num_incoming_msgs_received, num_msgs_received, num_msgs_sent, num_oob_msgs_received, num_timer_threads, 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, persistent_ports, persistent_ports_file, pm, pm_expiry_time, pool_thread_group, port_range, prevent_port_reuse, receive_interfaces, receive_on_all_interfaces, singleton_name, 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, timer, timer_thread_factory, use_local_host, view
 
Fields inherited from class org.jgroups.stack.Protocol
down_prot, log, 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.
 void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
           
 void postUnmarshallingList(Message msg, Address dest, boolean multicast)
           
abstract  java.lang.String printConnections()
           
 void receive(Address sender, byte[] data, int offset, int length)
          ConnectionTable.Receiver interface
abstract  void retainAll(java.util.Collection<Address> members)
           
abstract  void send(Address dest, byte[] data, int offset, int length)
           
 void sendToAllMembers(byte[] data, int offset, int length)
          Send to all members in the group.
 void sendToSingleMember(Address dest, byte[] data, int offset, int length)
          Send to all members in the group.
 void setConnExpireTime(long conn_expire_time)
           
 void setExternalAddress(java.lang.String addr)
           
 void setReaperInterval(long reaper_interval)
           
 
Methods inherited from class org.jgroups.protocols.TP
createThreadPool, destroy, down, getBindAddress, getBindAddressAsInetAddress, getBindPort, getBindToAllInterfaces, getChannelName, getDefaultThreadPool, getDefaultThreadPoolThreadFactory, getIncomingKeepAliveTime, getIncomingMaxPoolSize, getIncomingMaxQueueSize, getIncomingMessages, getIncomingMinPoolSize, getIncomingPoolSize, getIncomingQueueSize, getLocalAddress, getLocalAddressAsString, getLogDiscardMessages, getMaxBundleSize, getMaxBundleTimeout, getNumBytesReceived, getNumBytesSent, getNumMessagesReceived, getNumMessagesSent, getOOBKeepAliveTime, getOOBMaxPoolSize, getOOBMaxQueueSize, getOOBMessages, getOOBMinPoolSize, getOOBPoolSize, getOOBQueueSize, getOOBThreadPool, getOOBThreadPoolThreadFactory, getReceiveInterfaces, getSendInterfaces, getSingletonName, getThreadFactory, getThreadNamingPattern, getTimer, getTimerThreadFactory, getUpProtocols, handleConfigEvent, handleConnect, handleDisconnect, isDefaulThreadPoolEnabled, isDiscardIncompatiblePackets, isEnableBundling, isEnableUnicastBundling, isLoopback, isOOBThreadPoolEnabled, isReceiveOnAllInterfaces, isSendOnAllInterfaces, isSingleton, isUseIncomingPacketHandler, passToAllUpProtocols, receive, registerProbeHandler, resetStats, sendUpLocalAddressEvent, setBindAddress, setBindPort, setBindToAllInterfaces, setDefaultThreadPool, setDefaultThreadPoolThreadFactory, setDiscardIncompatiblePackets, setEnableBundling, setEnableUnicastBundling, setIncomingKeepAliveTime, setIncomingMaxPoolSize, setIncomingMinPoolSize, setLogDiscardMessages, setLoopback, setMaxBundleSize, setMaxBundleTimeout, setOOBKeepAliveTime, setOOBMaxPoolSize, setOOBMinPoolSize, setOOBThreadPool, setOOBThreadPoolThreadFactory, setPortRange, setThreadFactory, setThreadNames, setThreadPoolQueueEnabled, setTimerThreadFactory, setUseConcurrentStack, start, stop, toString, unregisterProbeHandler, unsetThreadNames, up
 
Methods inherited from class org.jgroups.stack.Protocol
downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getName, getProperties, getProtocolStack, getTransport, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
 
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

external_addr

protected java.net.InetAddress external_addr
Constructor Detail

BasicTCP

protected BasicTCP()
Method Detail

getReaperInterval

public long getReaperInterval()

setReaperInterval

public void setReaperInterval(long reaper_interval)

getConnExpireTime

public long getConnExpireTime()

setConnExpireTime

public void setConnExpireTime(long conn_expire_time)

setExternalAddress

public void setExternalAddress(java.lang.String addr)
                        throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

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

sendToAllMembers

public void sendToAllMembers(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:
sendToAllMembers in class TP
Parameters:
data - The data to be sent. This is not a copy, so don't modify it
Throws:
java.lang.Exception

sendToSingleMember

public void sendToSingleMember(Address dest,
                               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:
sendToSingleMember 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

postUnmarshalling

public void postUnmarshalling(Message msg,
                              Address dest,
                              Address src,
                              boolean multicast)
Specified by:
postUnmarshalling in class TP

postUnmarshallingList

public void postUnmarshallingList(Message msg,
                                  Address dest,
                                  boolean multicast)
Specified by:
postUnmarshallingList 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)
ConnectionTable.Receiver interface


handleDownEvent

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


Copyright © 1998-2008 Bela Ban. All Rights Reserved.