Package org.apache.synapse.transport.passthru.connections

## Class SourceConnections

- java.lang.Object
- - org.apache.synapse.transport.passthru.connections.SourceConnections

-     public class SourceConnections
      extends Object

  Keeps track of the connections coming in to the transport.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SourceConnections()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addConnection​(org.apache.http.nio.NHttpServerConnection conn)` | Add a connection to the pool.
    `void` | `closeConnection​(org.apache.http.nio.NHttpServerConnection conn)` | Close a connection gracefully.
    `void` | `closeConnection​(org.apache.http.nio.NHttpServerConnection conn, boolean isError)` | Close a connection gracefully.
    `void` | `destroy()` |
    `void` | `releaseConnection​(org.apache.http.nio.NHttpServerConnection conn)` | This method should be called after a connection is being used for a request-response.
    `void` | `shutDownConnection​(org.apache.http.nio.NHttpServerConnection conn)` | Shutdown a connection
    `void` | `shutDownConnection​(org.apache.http.nio.NHttpServerConnection conn, boolean isError)` | Shutdown a connection
    `void` | `useConnection​(org.apache.http.nio.NHttpServerConnection conn)` | This method should be called when ever a connection being used for processing a request-response.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SourceConnections

          public SourceConnections()

  - ### Method Detail

    - #### addConnection

          public void addConnection​(org.apache.http.nio.NHttpServerConnection conn)

      Add a connection to the pool.
      Parameters:
        `conn` - connection to be added

    - #### useConnection

          public void useConnection​(org.apache.http.nio.NHttpServerConnection conn)

      This method should be called when ever a connection being used for processing a request-response.
      Parameters:
        `conn` - the connection to be used

    - #### releaseConnection

          public void releaseConnection​(org.apache.http.nio.NHttpServerConnection conn)

      This method should be called after a connection is being used for a request-response.
      Parameters:
        `conn` - the connection being used

    - #### shutDownConnection

          public void shutDownConnection​(org.apache.http.nio.NHttpServerConnection conn)

      Shutdown a connection
      Parameters:
        `conn` - the connection that needs to be shut down

    - #### shutDownConnection

          public void shutDownConnection​(org.apache.http.nio.NHttpServerConnection conn,
                                         boolean isError)

      Shutdown a connection
      Parameters:
        `conn` - the connection that needs to be shut down
        `isError` - whether an error is causing this shutdown of the connection It is very important to set this flag correctly. When an error causing the shutdown of the connections we should not release associated writer buffer to the pool as it might lead into situations like same buffer is getting released to both source and target buffer factories

    - #### closeConnection

          public void closeConnection​(org.apache.http.nio.NHttpServerConnection conn)

      Close a connection gracefully.
      Parameters:
        `conn` - the connection that needs to be closed.

    - #### closeConnection

          public void closeConnection​(org.apache.http.nio.NHttpServerConnection conn,
                                      boolean isError)

      Close a connection gracefully.
      Parameters:
        `conn` - the connection that needs to be closed.
        `isError` - whether an error is causing the shutdown of the connection. When as error is causing a close of a connection we should not release the associated buffers into the pool.

    - #### destroy

          public void destroy()