electric.net.channel
Class ChannelPool

java.lang.Object
  extended byelectric.net.channel.ChannelPool

public final class ChannelPool
extends java.lang.Object

ChannelPool maintains a cache of IChannels. When you ask for an IChannel to a particular destination, the cache returns an existing channel if available, otherwise it returns null. If you add an IChannel to the cache and the preset maximum size has been reached, the least recently used IChannel is closed to make room for the new IChannel.

Author:
webMethods

Constructor Summary
ChannelPool()
           
ChannelPool(int maxCacheSize)
           
 
Method Summary
 void flush(XURL xurl)
           
 IChannel get(XURL xurl)
           
 int getCacheSize()
          Return number of channels in the cache
 XURL[] getHosts()
          Return a list of all hosts the pooled channels connected to
 int getMaxCacheSize()
           
 IChannel peek(XURL xurl)
           
 void put(XURL xurl, IChannel channel)
           
static void setDefaultMaxCacheSize(int defaultMaxCacheSize)
           
 void setMaxCacheSize(int max)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelPool

public ChannelPool()

ChannelPool

public ChannelPool(int maxCacheSize)
Parameters:
maxCacheSize -
Method Detail

get

public IChannel get(XURL xurl)
             throws java.io.IOException
Parameters:
xurl -
Throws:
java.io.IOException

peek

public IChannel peek(XURL xurl)
Parameters:
xurl -

put

public void put(XURL xurl,
                IChannel channel)
Parameters:
xurl -
channel -

flush

public void flush(XURL xurl)
Parameters:
xurl -

shutdown

public void shutdown()

setDefaultMaxCacheSize

public static void setDefaultMaxCacheSize(int defaultMaxCacheSize)
Parameters:
defaultMaxCacheSize -

getMaxCacheSize

public int getMaxCacheSize()

getCacheSize

public int getCacheSize()
Return number of channels in the cache


setMaxCacheSize

public void setMaxCacheSize(int max)
Parameters:
max -

getHosts

public XURL[] getHosts()
Return a list of all hosts the pooled channels connected to



copyright© 2001-2004 by webMethods All Rights Reserved.