net.spy.pool
Class PooledObject

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.pool.PooledObject

public class PooledObject
extends SpyObject

Pooled object return package. This object primarily exists as a means for having a safe way to have access to PoolAble objects. Anyone using a PooledObject will not be able to retrieve the object that was pooled after checking it back in, and it makes it safe to forget to check an object back in on occasion.


Constructor Summary
PooledObject(PoolAble p)
          Get a new PooledObject containing the given PoolAble
 
Method Summary
 void checkIn()
          Manually check the object back in.
protected  void finalize()
          Finalization will check-in any checked-out object that has not already been checked in.
 java.lang.Object getObject()
          Get the object we just checked out.
 int getObjectID()
          Get the objectID for the pool object we have checked out.
 boolean isAlive()
          Find out if the object is alive
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PooledObject

public PooledObject(PoolAble p)
Get a new PooledObject containing the given PoolAble

Method Detail

getObject

public java.lang.Object getObject()
                           throws PoolException
Get the object we just checked out.

Throws:
PoolException - if a problem occurs

isAlive

public boolean isAlive()
Find out if the object is alive

Returns:
true if the object is alive

checkIn

public void checkIn()
Manually check the object back in.


getObjectID

public int getObjectID()
Get the objectID for the pool object we have checked out.

Returns:
the object ID

finalize

protected void finalize()
Finalization will check-in any checked-out object that has not already been checked in.

Overrides:
finalize in class java.lang.Object


Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.