Interface Connection

All Known Subinterfaces:
CorbaConnection
All Known Implementing Classes:
SocketFactoryConnectionImpl, SocketOrChannelConnectionImpl

public interface Connection

Connection represents a transport in the PEPt architecture.

Author:
Harold Carr
  • Method Details

    • shouldRegisterReadEvent

      boolean shouldRegisterReadEvent()
      Used to determine if the Connection should register with the TransportManager Selector to handle read events. For example, an HTTP transport would not register since the requesting thread would just block on read when waiting for the reply.
      Returns:
      true if it should be registered.
    • shouldRegisterServerReadEvent

      boolean shouldRegisterServerReadEvent()
      Used to determine if the Connection should register with the TransportManager Selector to handle read events. For example, an HTTP transport would not register since the requesting thread would just block on read when waiting for the reply.
      Returns:
      true if it should be registered.
    • read

      boolean read()
      Called to read incoming messages.
      Returns:
      true if the thread calling read can be released.
    • close

      void close()
      Close the Connection.
    • getAcceptor

      Acceptor getAcceptor()
      Get the Acceptor that created this Connection.
      Returns:
      Acceptor
    • getContactInfo

      ContactInfo getContactInfo()
      Get the ContactInfo that created this Connection.
      Returns:
      ContactInfo
    • getEventHandler

      EventHandler getEventHandler()
      Get the EventHandler associated with this Acceptor.
      Returns:
      EventHandler
    • isServer

      boolean isServer()
      Indicates whether a ContactInfo or a Acceptor created the Connection.
      Returns:
      true if Connection an Acceptor created the Connection.
    • isBusy

      boolean isBusy()
      Indicates if the Connection is in the process of sending or receiving a message.
      Returns:
      true if the Connection is busy.
    • getTimeStamp

      long getTimeStamp()
      Timestamps are used for connection management, in particular, for reclaiming idle Connections.
      Returns:
      the "time" the Connection was last used.
    • setTimeStamp

      void setTimeStamp(long time)
      Timestamps are used for connection management, in particular, for reclaiming idle Connections.
      Parameters:
      time - - the "time" the Connection was last used.
    • setState

      void setState(String state)
      The "state" of the Connection. param state
    • writeLock

      void writeLock()
      Grab a write lock on the Connection. If another thread already has a write lock then the calling thread will block until the lock is released. The calling thread must call writeUnlock() when it is done.
    • writeUnlock

      void writeUnlock()
      Release a write lock on the Connection.
    • sendWithoutLock

      void sendWithoutLock(OutputObject outputObject)
    • registerWaiter

      void registerWaiter(MessageMediator messageMediator)
      Register an invocation's MessageMediator with the Connection. This is useful in protocols which support fragmentation.
      Parameters:
      messageMediator -
    • waitForResponse

      InputObject waitForResponse(MessageMediator messageMediator)
      If a message expect's a response then this method is called. This method might block on a read (e.g., HTTP), put the calling thread to sleep while another thread read's the response (e.g., GIOP), or it may use the calling thread to perform the server-side work (e.g., Solaris Doors).
      Parameters:
      messageMediator -
    • unregisterWaiter

      void unregisterWaiter(MessageMediator messageMediator)
      Unregister an invocation's MessageMediator with the Connection.
      Parameters:
      messageMediator -
    • setConnectionCache

      void setConnectionCache(ConnectionCache connectionCache)
    • getConnectionCache

      ConnectionCache getConnectionCache()