org.codehaus.xfire.util.factory
Class SingletonPool

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

public class SingletonPool
extends CachingPool

Represents a pooling strategy that pools the data in a variable that's global to all threads.
This implementation is thread-safe.

Author:
Ben Yu
See Also:
Serialized Form

Constructor Summary
SingletonPool()
           
 
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

SingletonPool

public SingletonPool()
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
Overrides:
getInstance in class CachingPool
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
Overrides:
getPooledInstance in class CachingPool
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 class: CachingPool
Is this pool currently having something in cache?

Specified by:
isPooled in interface Pool
Overrides:
isPooled in class CachingPool


Copyright © 2004-2008. All Rights Reserved.