cgl.narada.transport.threadpool
Class PoolTCPLink

java.lang.Object
  extended by cgl.narada.transport.threadpool.PoolTCPLink
All Implemented Interfaces:
Link, TransportDebugFlags

public class PoolTCPLink
extends Object
implements Link, TransportDebugFlags

This is a PoolTCP implementation of the Link interface. Say we are trying to establish a communication from node A to node B. To create links one needs the following properties to be specified.

  • hostname: This is the hostname on which the node B's process is running.
  • portnum: This is the port number on which node B accepts link creation requests from other nodes. In other words, the PoolTCPServerPort specified to the PoolTCPChannelFactory at node B is equal to portnum.


    Field Summary
     
    Fields inherited from interface cgl.narada.transport.TransportDebugFlags
    IPSecLink_Debug, IPSecLinkFactory_Debug, IPSecReceiverThread_Debug, IPSecSenderThread_Debug, IPSecServerThread_Debug, MulticastLink_Debug, MulticastLinkFactory_Debug, MulticastReceiverThread_Debug, MulticastSenderThread_Debug, NIOTCPLink_Debug, NIOTCPLinkFactory_Debug, NIOTCPReceiverThread_Debug, NIOTCPSenderThread_Debug, NIOTCPServerThread_Debug, PoolTCPLink_Debug, PoolTCPLinkFactory_Debug, PoolTCPLinkReceiver_Debug, PoolTCPLinkSender_Debug, PoolTCPServerThread_Debug, PTCPLink_Debug, PTCPLinkFactory_Debug, PTCPReceiverThread_Debug, PTCPSenderThread_Debug, PTCPServerThread_Debug, ReceiveTask_Debug, RTPLink_Debug, RTPLinkFactory_Debug, RTPReceiverThread_Debug, RTPSenderThread_Debug, SendTask_Debug, TCPLink_Debug, TCPLinkFactory_Debug, TCPReceiverThread_Debug, TCPSenderThread_Debug, TCPServerThread_Debug, TransmissionManager_Debug, TransportHandlerImpl_Debug, UDPLink_Debug, UDPLinkFactory_Debug, UDPReceiverThread_Debug, UDPSenderThread_Debug
     
    Constructor Summary
    PoolTCPLink(SocketChannel sc, PoolTCPLinkFactory pooltcpLinkFactory)
               
     
    Method Summary
     void closeLink()
              Garbage collect resources associated with this link.
     LinkPerformanceData[] getAllPerformanceData()
              Returns the complete set of performance factors measured and their corresponding values
     String getLinkId()
              Retrieves the String based id of the link
     String getLinkType()
              Returns the type of the communication link
     Object getNaradaBrokeringId()
              Returns the NaradaBrokeringId associated with this link
     String getPerformanceData(String factorName)
              Returns the value of a performance factor as a string
     String[] getPerformanceFactorsMeasured()
              Returns the list of performance factors that are measured on this communication link
     ReceiveTask getReceiver()
               
     String getSecurityInformation()
              Information pertaining to the security strategy adopted for this communication link
     SendTask getSender()
               
     TransportHandler getTransportHandler()
               
     boolean isSecure()
              Indicates weather communication is encrypted on this link
     boolean performanceGatheringEnabled()
              Used to test weather performing gathering is enabled for a given communication link
     void processLossOfSocketConnection()
              If the senderNotification is false, it implies that the detection of connection loss has been reported by the receiver thread.
     void sendData(byte[] data)
              The method used to send data over a communication link
     void sendData(byte[] data, String dataType)
              The method used to send data over a communication link, this method also includes information regarding the type (audio/video/xml-attachments etc.) of the data encapsulated within the data stream.
     void setKeepAliveTime(long keepAliveTime)
              Set the amount of time after which resources associated with this link need to be garbage collected.
     void setLinkId(String stringId)
              Sets the Id of the communication link
     void setLinkMigrationConstraint(String constraint, String linkType)
              Sets the conditions under which communication protocols need to be switched and the transport link that it should be switched to under the condition.
     void setLinkStatusInterval(long interval)
              Check the status of the communication link at intervals specified in the argument of this method
     void setNaradaBrokeringId(Object brokeringId)
              The Naradabrokering Id of the node this link interacts with
     void setPerformanceGathering(boolean gather)
              Used to enable or disable performance gathering on a communication link
     void setReceiver(ReceiveTask receiveTask)
               
     void setSender(SendTask sendTask)
               
     void startLinkServices()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    PoolTCPLink

    public PoolTCPLink(SocketChannel sc,
                       PoolTCPLinkFactory pooltcpLinkFactory)
                throws TransportException
    Throws:
    TransportException
    Method Detail

    startLinkServices

    public void startLinkServices()

    sendData

    public void sendData(byte[] data)
                  throws TransportException
    The method used to send data over a communication link

    Specified by:
    sendData in interface Link
    Throws:
    TransportException

    sendData

    public void sendData(byte[] data,
                         String dataType)
                  throws TransportException
    The method used to send data over a communication link, this method also includes information regarding the type (audio/video/xml-attachments etc.) of the data encapsulated within the data stream. Using this information links can optimally flush/send data across the link

    Specified by:
    sendData in interface Link
    Throws:
    TransportException

    setLinkId

    public void setLinkId(String stringId)
    Sets the Id of the communication link

    Specified by:
    setLinkId in interface Link

    getLinkId

    public String getLinkId()
    Retrieves the String based id of the link

    Specified by:
    getLinkId in interface Link

    setNaradaBrokeringId

    public void setNaradaBrokeringId(Object brokeringId)
    The Naradabrokering Id of the node this link interacts with

    Specified by:
    setNaradaBrokeringId in interface Link

    getNaradaBrokeringId

    public Object getNaradaBrokeringId()
    Returns the NaradaBrokeringId associated with this link

    Specified by:
    getNaradaBrokeringId in interface Link

    getLinkType

    public String getLinkType()
    Returns the type of the communication link

    Specified by:
    getLinkType in interface Link

    setLinkMigrationConstraint

    public void setLinkMigrationConstraint(String constraint,
                                           String linkType)
    Sets the conditions under which communication protocols need to be switched and the transport link that it should be switched to under the condition. Multiple constraints can be set signifying migration to different protocols.

    Specified by:
    setLinkMigrationConstraint in interface Link

    setLinkStatusInterval

    public void setLinkStatusInterval(long interval)
    Check the status of the communication link at intervals specified in the argument of this method

    Specified by:
    setLinkStatusInterval in interface Link

    setPerformanceGathering

    public void setPerformanceGathering(boolean gather)
    Used to enable or disable performance gathering on a communication link

    Specified by:
    setPerformanceGathering in interface Link

    performanceGatheringEnabled

    public boolean performanceGatheringEnabled()
    Used to test weather performing gathering is enabled for a given communication link

    Specified by:
    performanceGatheringEnabled in interface Link

    getPerformanceFactorsMeasured

    public String[] getPerformanceFactorsMeasured()
    Returns the list of performance factors that are measured on this communication link

    Specified by:
    getPerformanceFactorsMeasured in interface Link

    getAllPerformanceData

    public LinkPerformanceData[] getAllPerformanceData()
    Returns the complete set of performance factors measured and their corresponding values

    Specified by:
    getAllPerformanceData in interface Link

    getPerformanceData

    public String getPerformanceData(String factorName)
    Returns the value of a performance factor as a string

    Specified by:
    getPerformanceData in interface Link

    setKeepAliveTime

    public void setKeepAliveTime(long keepAliveTime)
    Set the amount of time after which resources associated with this link need to be garbage collected. A value of '0' indicates that this link needs to be active at all times.

    Specified by:
    setKeepAliveTime in interface Link

    closeLink

    public void closeLink()
    Garbage collect resources associated with this link. Sockets need to be closed and any resources associated with communication, needs to be garbage collected

    Specified by:
    closeLink in interface Link

    isSecure

    public boolean isSecure()
    Indicates weather communication is encrypted on this link

    Specified by:
    isSecure in interface Link

    getSecurityInformation

    public String getSecurityInformation()
    Information pertaining to the security strategy adopted for this communication link

    Specified by:
    getSecurityInformation in interface Link

    processLossOfSocketConnection

    public void processLossOfSocketConnection()
    If the senderNotification is false, it implies that the detection of connection loss has been reported by the receiver thread. Proceed to garbage collect the sender thread. If the boolean variable is true, it implies that the receiver thread has to be garbage collected.


    getTransportHandler

    public TransportHandler getTransportHandler()

    setSender

    public void setSender(SendTask sendTask)

    getSender

    public SendTask getSender()

    setReceiver

    public void setReceiver(ReceiveTask receiveTask)

    getReceiver

    public ReceiveTask getReceiver()


    For comments and suggestions please send e-mail to The NaradaBrokering Project