Examples of PoolableObjectFactory


Examples of org.apache.commons.pool.PoolableObjectFactory

                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

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

        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

   * @return the Commons PoolableObjectFactory
   * @see #createServerSession
   * @see #destroyServerSession
   */
  protected PoolableObjectFactory createPoolableObjectFactory(final ListenerSessionManager sessionManager) {
    return new PoolableObjectFactory() {
      public Object makeObject() throws JMSException {
        return createServerSession(sessionManager);
      }
      public void destroyObject(Object obj) {
        destroyServerSession((ServerSession) obj);
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

   * @return the Commons PoolableObjectFactory
   * @see #createServerSession
   * @see #destroyServerSession
   */
  protected PoolableObjectFactory createPoolableObjectFactory(final ListenerSessionManager sessionManager) {
    return new PoolableObjectFactory() {
      public Object makeObject() throws JMSException {
        return createServerSession(sessionManager);
      }
      public void destroyObject(Object obj) {
        destroyServerSession((ServerSession) obj);
View Full Code Here

Examples of org.apache.commons.pool.PoolableObjectFactory

   * @return the Commons PoolableObjectFactory
   * @see #createServerSession
   * @see #destroyServerSession
   */
  protected PoolableObjectFactory createPoolableObjectFactory(final ListenerSessionManager sessionManager) {
    return new PoolableObjectFactory() {
      public Object makeObject() throws JMSException {
        return createServerSession(sessionManager);
      }
      public void destroyObject(Object obj) {
        destroyServerSession((ServerSession) 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

                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

Examples of org.apache.commons.pool.PoolableObjectFactory

  public ConnectionPoolDataSource(DataSource underlyingDataSource) {
    if (underlyingDataSource == null) {
      throw new IllegalArgumentException("underlyingDataSource is null");
    }
    PoolableObjectFactory poolFactory = new DataSourceConnectionFactory(underlyingDataSource);
    ObjectPool connectionPool = new StackObjectPool(poolFactory);
    this.delegate = new PoolingDataSource(connectionPool);
  }
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
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.