org.formaria.pool
Class PoolObject

java.lang.Object
  extended by org.formaria.pool.PoolObject
Direct Known Subclasses:
ConnectionObject

public abstract class PoolObject
extends java.lang.Object

Provides some basic object management facilities for Pooled Objects

Copyright (c) Formaria Ltd. 2008

$Revision: 2.3 $


Constructor Summary
PoolObject()
           
 
Method Summary
abstract  void close()
          Close the object and return to the pool.
 void expireLease()
          Expire the object's lease
 boolean getInUse()
          Is the object in use?
 long getLastUse()
          Gets the last use time of the object
 boolean lease()
          Mark an object as being in use
abstract  boolean validate()
          Check to see if the object is still valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolObject

public PoolObject()
Method Detail

lease

public boolean lease()
Mark an object as being in use

Returns:
false if the object is in use, returns true if the object can be leased

validate

public abstract boolean validate()
Check to see if the object is still valid

Returns:
true if the underlying resource is valid

getInUse

public boolean getInUse()
Is the object in use?

Returns:
true if the object is in use

getLastUse

public long getLastUse()
Gets the last use time of the object

Returns:
the time in milliseconds

close

public abstract void close()
                    throws java.lang.Exception
Close the object and return to the pool.

Throws:
java.lang.Exception - close the underlying resource

expireLease

public void expireLease()
Expire the object's lease