Franz Inc, AllegroGraph

com.franz.agraph.pool
Class AGConnFactory

java.lang.Object
  extended by com.franz.util.Closer
      extended by com.franz.agraph.pool.AGConnFactory
All Implemented Interfaces:
Closeable, org.apache.commons.pool.PoolableObjectFactory

public class AGConnFactory
extends Closer
implements org.apache.commons.pool.PoolableObjectFactory

Adapts the AGRepositoryConnection API to the commons-pool factory interface, leaving creation of the connection (and configuration) to a subclass, defined by users of this library.

Since:
v4.3.3

Constructor Summary
AGConnFactory(AGConnConfig props)
           
AGConnFactory(AGConnConfig props, AGPoolConfig poolProps)
           
 
Method Summary
 void activateObject(Object obj)
          Calls AGRepositoryConnection.rollback() and resets AGRepositoryConnection.setAutoCommit(boolean) if it has changed.
 void destroyObject(Object obj)
           
<Obj> Obj
handleCloseException(Obj o, Throwable e)
          Subclass may override, default behavior is to log.warn and return the object.
 Object makeObject()
           
 void passivateObject(Object obj)
           
 boolean validateObject(Object obj)
          Calls AGRepositoryConnection.size(org.openrdf.model.Resource...).
 
Methods inherited from class com.franz.util.Closer
close, close, Close, close, Close, close, Close, close, Close, close, Close, close, Close, close, Close, close, Close, closeAll, closeLater, closeReflection, remove, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AGConnFactory

public AGConnFactory(AGConnConfig props)

AGConnFactory

public AGConnFactory(AGConnConfig props,
                     AGPoolConfig poolProps)
Method Detail

makeObject

public Object makeObject()
                  throws Exception
Specified by:
makeObject in interface org.apache.commons.pool.PoolableObjectFactory
Throws:
Exception

activateObject

public void activateObject(Object obj)
                    throws Exception
Calls AGRepositoryConnection.rollback() and resets AGRepositoryConnection.setAutoCommit(boolean) if it has changed.

Specified by:
activateObject in interface org.apache.commons.pool.PoolableObjectFactory
Throws:
Exception

destroyObject

public void destroyObject(Object obj)
                   throws Exception
Specified by:
destroyObject in interface org.apache.commons.pool.PoolableObjectFactory
Throws:
Exception

passivateObject

public void passivateObject(Object obj)
                     throws Exception
Specified by:
passivateObject in interface org.apache.commons.pool.PoolableObjectFactory
Throws:
Exception

validateObject

public boolean validateObject(Object obj)
Calls AGRepositoryConnection.size(org.openrdf.model.Resource...).

Specified by:
validateObject in interface org.apache.commons.pool.PoolableObjectFactory

handleCloseException

public <Obj> Obj handleCloseException(Obj o,
                                      Throwable e)
Description copied from class: Closer
Subclass may override, default behavior is to log.warn and return the object.

Overrides:
handleCloseException in class Closer

Copyright © 2008-2016 Franz Inc.