Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.emory.mathcs.util.net
Class Connection

    java.lang.Object
      edu.emory.mathcs.util.net.Connection

public class Connection
extends java.lang.Object

Single connection from pool of connections. Every connection has associated connected socket and expiration timeout.

Version:
  1.0
Author:
  Dawid Kurzyniec, Tomasz Janiak
See Also:
  `ConnectionPool`

Method Summary
`void` | `close()` Closes this connection.
`java.net.Socket` | `getSocket()` Returns the socket associated with this connection.
`void` | `returnToPool()` Returns this connection to its pool.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### returnToPool

    public void returnToPool()

  Returns this connection to its pool. This method should be called only if it is safe to reuse the connection in the future; otherwise, the connection should be `closed`. Connection may be not reusable if it is left by the preceding operation in an inconsistent state, e.g. if the client failed to read all the data written by the server etc. The precise meaning of a consistent state is defined by a higher-level application protocol.

  After returning the connection to the pool, client should not use or close the socket associated with that connection.

### close

    public void close()

  Closes this connection.

### getSocket

    public java.net.Socket getSocket()

  Returns the socket associated with this connection.

  Returns:
    the socket associated with this connection

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD