Examples of PoolableObjectFactory


Examples of org.apache.commons.pool.PoolableObjectFactory

        super(testName);
    }

    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

    GenericObjectPool objectPool = new GenericObjectPool();
    objectPool.setTestOnBorrow(false);
    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
    PoolableObjectFactory factory = new PoolableConnectionFactory(connectionFactory, objectPool, null,
        "SELECT 1", false, false);
    objectPool.setFactory(factory);
    delegate = new PoolingDataSource(objectPool);
  }
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

    }

    public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
        ObjectPool pool = new StackObjectPool(20);
        pool.setFactory(
            new PoolableObjectFactory() {
                int counter = 0;
                public Object makeObject() { return new Integer(counter++); }
                public void destroyObject(Object obj) { }
                public boolean validateObject(Object obj) {
                    if(obj instanceof Integer) {
View Full Code Here

Examples of org.apache.commons.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

Examples of org.apache.commons.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

Examples of org.apache.commons.pool.PoolableObjectFactory

   
    /**
     * Verifies that initIdleCapacity is not a hard limit, but maxIdle is.
     */
    public void testInitIdleCapacityExceeded() throws Exception {
        PoolableObjectFactory factory = new SimpleFactory();
        ObjectPool pool = new StackObjectPool(factory, 2, 1);
        pool.addObject();
        pool.addObject();
        assertEquals(2, pool.getNumIdle());
        pool.close();
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.apache.commons.pool.PoolableObjectFactory

        if (pool==null)
            synchronized(poolMutex) {
                if (pool==null) {
                    //
                    // create a PoolableObjectFactory based on a ComponentFactory
                    PoolableObjectFactory pooleableFactory = new BasePoolableObjectFactory() {
                        public Object makeObject() throws Exception {
                            return beanFactory.getBean(id);
                        }
                    };
                    //
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

    public LogicaSMSChannelAdapter(String channelName, Map channelInfo)
                            throws MessageException {

        try {
            processChannelInfo(channelName, channelInfo);
            final PoolableObjectFactory sessionFactory =
                    new PoolableSessionFactory(SMSCAddress, SMSCPort, SMSCUser,
                            SMSCPassword, SMSCBindType);
            this.sessionPool = initializeSessionPool(channelInfo, sessionFactory);
            this.sessionValidator = initializeSessionValidator(channelInfo);
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.