Examples of PoolableObjectFactory


Examples of org.apache.commons.pool.PoolableObjectFactory

    private final List destroyed = new ArrayList();
    public void testReturnObjectDiscardOrder() throws Exception {
        // setup
        // We need a factory that tracks what was discarded.
        PoolableObjectFactory pof = new PoolableObjectFactory() {
            int i = 0;
            public Object makeObject() throws Exception {
                return new Integer(i++);
            }
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

        return new TestSuite(TestSoftReferenceObjectPool.class);
    }

    protected ObjectPool makeEmptyPool(int cap) {
        return new SoftReferenceObjectPool(
            new PoolableObjectFactory()  {
                int counter = 0;
                public Object makeObject() { return String.valueOf(counter++); }
                public void destroyObject(Object obj) { }
                public boolean validateObject(Object obj) { return true; }
                public void activateObject(Object obj) { }
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

     * Override this method to implement your on {@link org.apache.commons.pool.ObjectPool}.
     */
    public ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
    {
        if (log.isDebugEnabled()) log.debug("createPool was called");
        PoolableObjectFactory pof = new ConPoolFactory(this, jcd);
        GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();
        ObjectPool op = new GenericObjectPool(pof, conf);
        return op;
    }
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

    private SoftReferenceObjectPool pool = null;

    public void setUp() {
        pool = new SoftReferenceObjectPool(
            new PoolableObjectFactory()  {
                int counter = 0;
                public Object makeObject() { return String.valueOf(counter++); }
                public void destroyObject(Object obj) { }
                public boolean validateObject(Object obj) { return true; }
                public void activateObject(Object obj) { }
View Full Code Here

Examples of org.datanucleus.store.rdbms.datasource.dbcp.pool.PoolableObjectFactory

     * @throws IllegalStateException when the factory cannot be set at this time
     * @deprecated to be removed in version 2.0
     */
    public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
        List toDestroy = new ArrayList();
        final PoolableObjectFactory oldFactory = _factory;
        synchronized (this) {
            assertOpen();
            if(0 < getNumActive()) {
                throw new IllegalStateException("Objects are already active");
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.