org.beepcore.beep.lib
Class ChannelPool

java.lang.Object
  extended byorg.beepcore.beep.lib.ChannelPool

public class ChannelPool
extends java.lang.Object

ChannelPool holds a collection of available SharedChannel(s) and provides access to them. Availabe SharedChannel(s) are retrieved through the getSharedChannel. Each SharedChannel has a time to live, after which, it is removed from the pool.


Constructor Summary
ChannelPool(Session session)
          Creates a ChannelPool with the given session.
ChannelPool(Session session, long ttl)
          Creates a ChannelPool with the given session and time to live.
 
Method Summary
 void close()
          Closes down the channel pool, its session and all associated channels.
 SharedChannel getSharedChannel(java.lang.String profile)
          Returns a SharedChannel which supports the specified profile.
 SharedChannel getSharedChannel(java.lang.String profile, MessageListener listener)
          Deprecated.  
 SharedChannel getSharedChannel(java.lang.String profile, RequestHandler handler)
          Deprecated.  
 void setSharedChannelTTL(long ttl)
          Sets the time to live or the number of milleseconds an unused channel will remain in the pool before it is removed from the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelPool

public ChannelPool(Session session)
Creates a ChannelPool with the given session.

Parameters:
session - The session on which all SharedChannel(s) returned from getSharedChannel are started.
See Also:
getSharedChannel(java.lang.String)

ChannelPool

public ChannelPool(Session session,
                   long ttl)
Creates a ChannelPool with the given session and time to live.

Parameters:
session - The session on which all SharedChannel(s) returned from getSharedChannel are started.
ttl - The time in milleseconds an available SharedChannel will live in ChannelPool
See Also:
getSharedChannel(java.lang.String)
Method Detail

getSharedChannel

public SharedChannel getSharedChannel(java.lang.String profile)
                               throws BEEPException
Returns a SharedChannel which supports the specified profile.

Parameters:
profile - Name of a profile for the requested SharedChannel.
Returns:
A SharedChannel for the requested profile.
Throws:
BEEPException

getSharedChannel

public SharedChannel getSharedChannel(java.lang.String profile,
                                      MessageListener listener)
                               throws BEEPException
Deprecated.  

Returns a SharedChannel which supports the specified profile and calls back on the specified DataListener. Once it is no longer needed, call release on the SharedChannel to return it to the pool of available channels.

Parameters:
profile - Name of profile for the requested SharedChannel.
listener - DataListener for the requested SharedChannel.
Returns:
A SharedChannel.
Throws:
BEEPException
See Also:
MessageListener, SharedChannel

getSharedChannel

public SharedChannel getSharedChannel(java.lang.String profile,
                                      RequestHandler handler)
                               throws BEEPException
Deprecated.  

Returns a SharedChannel which supports the specified profile and calls back on the specified DataListener. Once it is no longer needed, call release on the SharedChannel to return it to the pool of available channels.

Parameters:
profile - Name of profile for the requested SharedChannel.
handler - RequestHandler for the requested SharedChannel.
Returns:
A SharedChannel.
Throws:
BEEPException
See Also:
MessageListener, SharedChannel

setSharedChannelTTL

public void setSharedChannelTTL(long ttl)
Sets the time to live or the number of milleseconds an unused channel will remain in the pool before it is removed from the pool. The default time to live is two minutes.

Parameters:
ttl - The time this channel has to live in the pool while in an available state.

close

public void close()
Closes down the channel pool, its session and all associated channels.



Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.