org.sapia.ubik.net
Class ConnectionPool

java.lang.Object
  extended by org.sapia.ubik.net.ConnectionPool

public class ConnectionPool
extends java.lang.Object

Implements a pool of Connection instances.

Author:
Yanick Duchesne 2002-08-09

Field Summary
protected  int _currentCount
           
protected  ConnectionFactory _fac
           
protected  java.lang.String _host
           
protected  long _lastUsageTime
           
protected  int _maxSize
           
protected  int _port
           
protected  java.rmi.server.RMIClientSocketFactory _socketFactory
           
static long DEFAULT_ACQUIRE_TIME_OUT
           
 
Constructor Summary
ConnectionPool(java.lang.String host, int port, ConnectionFactory fac, java.rmi.server.RMIClientSocketFactory socketFactory)
           
ConnectionPool(java.lang.String host, int port, ConnectionFactory fac, java.rmi.server.RMIClientSocketFactory socketFactory, int maxSize)
           
ConnectionPool(java.lang.String host, int port, int maxSize, java.rmi.server.RMIClientSocketFactory socketFactory)
           
ConnectionPool(java.lang.String host, int port, java.rmi.server.RMIClientSocketFactory socketFactory)
           
 
Method Summary
 Connection acquire()
           
 Connection acquire(long timeout)
           
 int getCount()
           
 long getLastUsageTime()
          Returns the time an object was last acquired from this pool.
protected  Connection newConnection()
           
 void release(Connection conn)
           
 void shrinkTo(int size)
          Shrinks the pool to the specified size, or until the pool is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ACQUIRE_TIME_OUT

public static final long DEFAULT_ACQUIRE_TIME_OUT
See Also:
Constant Field Values

_fac

protected ConnectionFactory _fac

_host

protected java.lang.String _host

_port

protected int _port

_maxSize

protected int _maxSize

_currentCount

protected int _currentCount

_lastUsageTime

protected long _lastUsageTime

_socketFactory

protected java.rmi.server.RMIClientSocketFactory _socketFactory
Constructor Detail

ConnectionPool

public ConnectionPool(java.lang.String host,
                      int port,
                      ConnectionFactory fac,
                      java.rmi.server.RMIClientSocketFactory socketFactory)

ConnectionPool

public ConnectionPool(java.lang.String host,
                      int port,
                      ConnectionFactory fac,
                      java.rmi.server.RMIClientSocketFactory socketFactory,
                      int maxSize)

ConnectionPool

public ConnectionPool(java.lang.String host,
                      int port,
                      java.rmi.server.RMIClientSocketFactory socketFactory)

ConnectionPool

public ConnectionPool(java.lang.String host,
                      int port,
                      int maxSize,
                      java.rmi.server.RMIClientSocketFactory socketFactory)
Method Detail

acquire

public Connection acquire()
                   throws java.io.IOException
Throws:
java.io.IOException

acquire

public Connection acquire(long timeout)
                   throws java.io.IOException
Throws:
java.io.IOException

release

public void release(Connection conn)

getCount

public int getCount()

getLastUsageTime

public long getLastUsageTime()
Returns the time an object was last acquired from this pool.


shrinkTo

public void shrinkTo(int size)
Shrinks the pool to the specified size, or until the pool is empty.

Parameters:
size - the size to which to shrink the pool.

newConnection

protected Connection newConnection()
                            throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2010 Sapia OSS. All Rights Reserved.