Package org.apache.commons.pool

Examples of org.apache.commons.pool.BasePoolableObjectFactory


  public boolean isPoolable() {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory() {
    return  new BasePoolableObjectFactory() {
      public Object makeObject() {
        return new Data();
      }
      public void passivateObject(Object obj) {
        Data ed = (Data)obj;
View Full Code Here


  public boolean isPoolable() {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory() {
    return  new BasePoolableObjectFactory() {
      public Object makeObject() {
        return new Data();
      }
      public void passivateObject(Object obj) {
        Data d = (Data)obj;
View Full Code Here

  public boolean isPoolable() {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory() {
    return  new BasePoolableObjectFactory() {
      public Object makeObject() {
        return new Data();
      }
      public void passivateObject(Object obj) {
        Data ed = (Data)obj;
View Full Code Here

  public boolean isPoolable()  {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory()  {
    return  new  BasePoolableObjectFactory()  {
      public Object makeObject() {
        return new ChatData();
      }
      public void  passivateObject(Object obj)  {
        ChatData ed  = (ChatData)obj;
View Full Code Here

  public boolean isPoolable() {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory() {
    return  new BasePoolableObjectFactory() {
      public Object makeObject() {
        return new Data();
      }
      public void passivateObject(Object obj) {
        Data ed = (Data)obj;
View Full Code Here

  public boolean isPoolable() {
    return true;
  }

  public PoolableObjectFactory getPoolableObjectFactory() {
    return  new BasePoolableObjectFactory() {
      public Object makeObject() {
        return new EchoWSData();
      }
      public void passivateObject(Object obj) {
        EchoWSData ed = (EchoWSData)obj;
View Full Code Here

    /**
     * Makes sure an {@link OutOfMemoryError} isn't swallowed.
     */
    public void testOutOfMemoryError() throws Exception {
        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                throw new OutOfMemoryError();
            }
        });

        try {
            pool.borrowObject();
            fail("Expected out of memory.");
        }
        catch (OutOfMemoryError ex) {
            // expected
        }
        pool.close();

        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                return new Object();
            }

            public boolean validateObject(Object obj) {
                throw new OutOfMemoryError();
            }
        });

        try {
            pool.borrowObject();
            fail("Expected out of memory.");
        }
        catch (OutOfMemoryError ex) {
            // expected
        }
        pool.close();
       
        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                return new Object();
            }

            public boolean validateObject(Object obj) {
View Full Code Here

        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

                String nodeRootPath = rootPath+"/"+name;
                beanClassNodeRootPaths.put(beanClass, nodeRootPath);
            }
           
            // create JCR credentials session pool
            PoolableObjectFactory sessionFactory = new BasePoolableObjectFactory()
            {
                /* (non-Javadoc)
                 * @see org.apache.commons.pool.BasePoolableObjectFactory#passivateObject(java.lang.Object)
                 */
                public void passivateObject(Object obj) throws Exception
View Full Code Here

    /**
     * Makes sure an {@link OutOfMemoryError} isn't swallowed.
     */
    public void testOutOfMemoryError() throws Exception {
        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                throw new OutOfMemoryError();
            }
        });

        try {
            pool.borrowObject();
            fail("Expected out of memory.");
        }
        catch (OutOfMemoryError ex) {
            // expected
        }
        pool.close();

        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                return new Object();
            }

            public boolean validateObject(Object obj) {
                throw new OutOfMemoryError();
            }
        });

        try {
            pool.borrowObject();
            fail("Expected out of memory.");
        }
        catch (OutOfMemoryError ex) {
            // expected
        }
        pool.close();
       
        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
            public Object makeObject() throws Exception {
                return new Object();
            }

            public boolean validateObject(Object obj) {
View Full Code Here

TOP

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

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.