org.codehaus.xfire.util.factory
Class ThreadSingletonPool

java.lang.Object
  extended by org.codehaus.xfire.util.factory.ThreadSingletonPool
All Implemented Interfaces:
java.io.Serializable, Pool

public class ThreadSingletonPool
extends java.lang.Object
implements Pool

Represents a pooling strategy that pools the data into a ThreadLocal object.

Author:
Ben Yu
See Also:
Serialized Form

Constructor Summary
ThreadSingletonPool()
           
 
Method Summary
 java.lang.Object getInstance(Factory factory)
          Apply the pooling strategy and return an instance from either the pool or the factory.
 java.lang.Object getPooledInstance(java.lang.Object def)
          Get the instance that's already pooled.
 boolean isPooled()
          Is this pool currently having something in cache?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSingletonPool

public ThreadSingletonPool()
Method Detail

getInstance

public java.lang.Object getInstance(Factory factory)
                             throws java.lang.Throwable
Description copied from interface: Pool
Apply the pooling strategy and return an instance from either the pool or the factory.

Specified by:
getInstance in interface Pool
Parameters:
factory - the factory to create the object instance.
Returns:
the object instance.
Throws:
java.lang.Throwable

getPooledInstance

public java.lang.Object getPooledInstance(java.lang.Object def)
Description copied from interface: Pool
Get the instance that's already pooled.

Specified by:
getPooledInstance in interface Pool
Parameters:
def - the default value to return if there's no pooled instance.
Returns:
the pooled instance or the default object.

isPooled

public boolean isPooled()
Description copied from interface: Pool
Is this pool currently having something in cache?

Specified by:
isPooled in interface Pool


Copyright © 2004-2009. All Rights Reserved.