Package org.apache.commons.pool

Examples of org.apache.commons.pool.KeyedPoolableObjectFactory


        this.dispatcherFactory = dispatcherFactory;
    }

    private KeyedPoolableObjectFactory getWrappedDispatcherFactory(MessageDispatcherFactory dispatcherFactory)
    {
        KeyedPoolableObjectFactory poolFactory;
        if (dispatcherFactory instanceof KeyedPoolableObjectFactory)
        {
            poolFactory = (KeyedPoolableObjectFactory) dispatcherFactory;
        }
        else
View Full Code Here


     * @param requesterFactory The requesterFactory to set.
     */
    @Override
    public void setRequesterFactory(MessageRequesterFactory requesterFactory)
    {
        KeyedPoolableObjectFactory poolFactory;

        if (requesterFactory instanceof KeyedPoolableObjectFactory)
        {
            poolFactory = (KeyedPoolableObjectFactory) requesterFactory;
        }
View Full Code Here

                maxPooledGroups = Math.max(maxPooledGroups, Integer
                        .parseInt(g.getPoolCapacity()));

            }

            KeyedPoolableObjectFactory factory = new Group.GroupFactory(
                    appData);
            keyedPools.put(appData, new StackKeyedObjectPool(factory,
                    maxPooledGroups));
        }
View Full Code Here

        return new TestSuite(TestGenericKeyedObjectPool.class);
    }

    protected KeyedObjectPool makeEmptyPool(int mincapacity) {
        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(
            new KeyedPoolableObjectFactory()  {
                HashMap map = new HashMap();
                public Object makeObject(Object key) {
                    int counter = 0;
                    Integer Counter = (Integer)(map.get(key));
                    if(null != Counter) {
View Full Code Here

    private StackKeyedObjectPool pool = null;

    public void setUp() throws Exception {
        super.setUp();
        pool = new StackKeyedObjectPool(
            new KeyedPoolableObjectFactory()  {
                int counter = 0;
                public Object makeObject(Object key) { return String.valueOf(key) + String.valueOf(counter++); }
                public void destroyObject(Object key, Object obj) { }
                public boolean validateObject(Object key, Object obj) { return true; }
                public void activateObject(Object key, Object obj) { }
View Full Code Here

        }
    }

    public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
        KeyedObjectPool pool = new StackKeyedObjectPool(
            new KeyedPoolableObjectFactory() {
                int counter = 0;
                public Object makeObject(Object key) { return new Integer(counter++); }
                public void destroyObject(Object key, Object obj) { }
                public boolean validateObject(Object key, Object obj) {
                    if(obj instanceof Integer) {
View Full Code Here

                            Math.max(maxPooledGroups,
                                    Integer.parseInt(g.getPoolCapacity()));

                }

                KeyedPoolableObjectFactory factory =
                        new Group.GroupFactory(appData);
                keyedPools.put(appData, new StackKeyedObjectPool(factory, maxPooledGroups));
            }

            setInit(true);
View Full Code Here

            // mkalen: let the platform set Oracle-specific statement pooling
            return null;
        }

        final KeyedObjectPoolFactory stmtPoolFactory;
        final KeyedPoolableObjectFactory objectFactory = null;
        final GenericKeyedObjectPool.Config factoryConfig = new GenericKeyedObjectPool.Config();
        /*
        // TODO: mkalen: allow to configure PreparedStatement pool
        final int maxTotalStmts = 100;
        factoryConfig.maxActive = (int) (maxTotalStmts * 0.7);
 
View Full Code Here

        return new TestSuite(TestGenericKeyedObjectPool.class);
    }

    protected KeyedObjectPool makeEmptyPool(int mincapacity) {
        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(
            new KeyedPoolableObjectFactory()  {
                HashMap map = new HashMap();
                public Object makeObject(Object key) {
                    int counter = 0;
                    Integer Counter = (Integer)(map.get(key));
                    if(null != Counter) {
View Full Code Here

    private StackKeyedObjectPool pool = null;

    public void setUp() throws Exception {
        super.setUp();
        pool = new StackKeyedObjectPool(
            new KeyedPoolableObjectFactory()  {
                int counter = 0;
                public Object makeObject(Object key) { return String.valueOf(key) + String.valueOf(counter++); }
                public void destroyObject(Object key, Object obj) { }
                public boolean validateObject(Object key, Object obj) { return true; }
                public void activateObject(Object key, Object obj) { }
View Full Code Here

TOP

Related Classes of org.apache.commons.pool.KeyedPoolableObjectFactory

Copyright © 2018 www.massapicom. 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.