nl.knowledgeplaza.util.pool
Class ApacheObjectPoolWrapper

java.lang.Object
  extended by nl.knowledgeplaza.util.pool.ApacheObjectPoolWrapper
All Implemented Interfaces:
org.apache.commons.pool.ObjectPool

public class ApacheObjectPoolWrapper
extends Object
implements org.apache.commons.pool.ObjectPool

This is a wrapper of the Apache's ObjectPool 1.3: - getting rid of the "throws Exception" - implement a shutdown mode before close

Version:
$Revision: 1.2 $

Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
ApacheObjectPoolWrapper(org.apache.commons.pool.ObjectPool pool)
           
ApacheObjectPoolWrapper(String name, org.apache.commons.pool.ObjectPool pool)
           
 
Method Summary
 void addObject()
           
 Object borrowObject()
           
 void clear()
           
 void close()
           
 String getName()
           
 String getNameDescription()
           
 int getNumActive()
           
 int getNumIdle()
           
 org.apache.commons.pool.ObjectPool getPool()
           
 void invalidateObject(Object arg0)
           
static void main(String[] args)
          Test
 void returnObject(Object arg0)
          You may return a proxied object instead of the actual borrow object
 void setFactory(org.apache.commons.pool.PoolableObjectFactory arg0)
           
protected  void setName(String value)
           
protected  void setPool(org.apache.commons.pool.ObjectPool value)
           
 void shutdown()
          Shutdowns means about to close, but handed out objects can be returned and will be discarded immediately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

ApacheObjectPoolWrapper

public ApacheObjectPoolWrapper(org.apache.commons.pool.ObjectPool pool)

ApacheObjectPoolWrapper

public ApacheObjectPoolWrapper(String name,
                               org.apache.commons.pool.ObjectPool pool)
Method Detail

getPool

public org.apache.commons.pool.ObjectPool getPool()

setPool

protected void setPool(org.apache.commons.pool.ObjectPool value)

getName

public String getName()

setName

protected void setName(String value)

getNameDescription

public String getNameDescription()

borrowObject

public Object borrowObject()
Specified by:
borrowObject in interface org.apache.commons.pool.ObjectPool

returnObject

public void returnObject(Object arg0)
You may return a proxied object instead of the actual borrow object

Specified by:
returnObject in interface org.apache.commons.pool.ObjectPool

invalidateObject

public void invalidateObject(Object arg0)
Specified by:
invalidateObject in interface org.apache.commons.pool.ObjectPool

addObject

public void addObject()
Specified by:
addObject in interface org.apache.commons.pool.ObjectPool

getNumIdle

public int getNumIdle()
               throws UnsupportedOperationException
Specified by:
getNumIdle in interface org.apache.commons.pool.ObjectPool
Throws:
UnsupportedOperationException

getNumActive

public int getNumActive()
                 throws UnsupportedOperationException
Specified by:
getNumActive in interface org.apache.commons.pool.ObjectPool
Throws:
UnsupportedOperationException

clear

public void clear()
           throws UnsupportedOperationException
Specified by:
clear in interface org.apache.commons.pool.ObjectPool
Throws:
UnsupportedOperationException

close

public void close()
Specified by:
close in interface org.apache.commons.pool.ObjectPool

setFactory

public void setFactory(org.apache.commons.pool.PoolableObjectFactory arg0)
                throws IllegalStateException,
                       UnsupportedOperationException
Specified by:
setFactory in interface org.apache.commons.pool.ObjectPool
Throws:
IllegalStateException
UnsupportedOperationException

shutdown

public void shutdown()
Shutdowns means about to close, but handed out objects can be returned and will be discarded immediately


main

public static void main(String[] args)
Test



Copyright © 2012 KnowledgePlaza. All Rights Reserved.