Jwma

dtw.webmail.util
Class CastorDatabasePool

java.lang.Object
  |
  +--dtw.webmail.util.CastorDatabasePool

public class CastorDatabasePool
extends java.lang.Object

Class that implements a pool for CastorDatabase instances.
The factory method is used for creating pools of the given database and size, using the database's factory method to create the requested amount of instances.

Version:
0.9.7 07/02/2003
Author:
Dieter Wimberger

Method Summary
 void clear()
          Removes all CastorDatabase references from this pool.
static CastorDatabasePool createCastorDatabasePool(int size, CastorDatabase database)
          Creates a CastorDatabasePool with the given size, containing the given CastorDatabase instances.
 int getCeiling()
          Returns the ceiling (in terms of size) of this pool.
protected  void initPool()
          Initializes a pool of CastorDatabases instances.
 CastorDatabase leaseDatabase()
          Returns a leased CastorDatabase instance from this pool.
 void releaseDatabase(CastorDatabase database)
          Releases a formerly leased CastorDatabase, returning it into this pool.
 void resize(int size)
          Resizes the pool.
 int size()
          Returns the size of this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

leaseDatabase

public CastorDatabase leaseDatabase()
Returns a leased CastorDatabase instance from this pool.

Returns:
the leased CastorDatabase from this pool.

releaseDatabase

public void releaseDatabase(CastorDatabase database)
Releases a formerly leased CastorDatabase, returning it into this pool.

Parameters:
database - the formerly leased CastorDatabase to be released.

getCeiling

public int getCeiling()
Returns the ceiling (in terms of size) of this pool.

Returns:
the ceiling size of this pool as int.

size

public int size()
Returns the size of this pool.

Returns:
the actual size of this pool as int.

resize

public void resize(int size)
Resizes the pool.

Parameters:
size - the new size as int.

clear

public void clear()
Removes all CastorDatabase references from this pool. Note that it will do so gracefully, waiting for leased CastorDatabases.


initPool

protected void initPool()
Initializes a pool of CastorDatabases instances.


createCastorDatabasePool

public static CastorDatabasePool createCastorDatabasePool(int size,
                                                          CastorDatabase database)
Creates a CastorDatabasePool with the given size, containing the given CastorDatabase instances.

Parameters:
size - the size as int.

Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)