TopoWeb Commons API
Interface SessionPool

public interface SessionPool

Interface for creating and/or recycling Session objects. This recycling does not concern itself with a session's underlying socket; rather, besides the socket itself, the resources used to maintain the conversational state in a Session instance may be worth recycling.

Additionally, this interface can be considered a factory interface for Session instances.

Babak Farhang
See Also:

Method Summary
 void freeSession(Session session)
          Frees the given session.
 Session getSession(java.nio.channels.SocketChannel channel)
          Returns a Session instance using the specified socket channel.

Method Detail


public Session getSession(java.nio.channels.SocketChannel channel)
Returns a Session instance using the specified socket channel. The returned instance may be from a pool of recyclable Session instance.

channel - the socket channel associated with returned instance
a Session instance using the given socket channel


public void freeSession(Session session)
Frees the given session. A freed Session instance may not be used again, unless it happens to be returned by the getSession method of this interface.

Note that a SessionPool instance is not supposed to manage a session's underlying socket (such as closing it); the session's underlying socket is supposed to be closed elsewhere.

session - the Session to be freed

TopoWeb Commons API

Copyright (C) 2002 Babak Farhang

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.