Package org.eclipse.persistence.sessions.server

Examples of org.eclipse.persistence.sessions.server.ConnectionPool


     */
    public void resetAllConnections() {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            Iterator enumtr = ((ServerSession)getSession()).getConnectionPools().values().iterator();
            while (enumtr.hasNext()) {
                ConnectionPool pool = (ConnectionPool)enumtr.next();
                pool.shutDown();
                pool.startUp();
            }
        } else if (ClassConstants.PublicInterfaceDatabaseSession_Class.isAssignableFrom(getSession().getClass())) {
            getSession().getAccessor().reestablishConnection(getSession());
        }
    }
View Full Code Here


     * @param poolName the name of the pool to get the max size for
     * @return Integer for the max size of the pool. Return -1 if pool doesn't exist.
     */
     public Integer getMaxSizeForPool(String poolName) {
         if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
             ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
             if (connectionPool != null) {
                 return Integer.valueOf(connectionPool.getMaxNumberOfConnections());
             }
         }
         return Integer.valueOf(-1);
     }
View Full Code Here

     * @param poolName the name of the pool to get the min size for
     * @return Integer for the min size of the pool. Return -1 if pool doesn't exist.
     */
     public Integer getMinSizeForPool(String poolName) {
         if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
             ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
             if (connectionPool != null) {
                 return Integer.valueOf(connectionPool.getMinNumberOfConnections());
             }
         }
         return Integer.valueOf(-1);
     }
View Full Code Here

     * @param maxSize the new maximum number of connections
     * @param minSize the new minimum number of connections
     */
    public void updatePoolSize(String poolName, int maxSize, int minSize) {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
            if (connectionPool != null) {
                connectionPool.setMaxNumberOfConnections(maxSize);
                connectionPool.setMinNumberOfConnections(minSize);
            }
        }
    }
View Full Code Here

     * The second value is the Minimum size of the pool.
     */
    public List getSizeForPool(String poolName) {
        Vector results = new Vector(2);
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
            if (connectionPool != null) {
                results.add(Integer.valueOf(connectionPool.getMaxNumberOfConnections()));
                results.add(Integer.valueOf(connectionPool.getMinNumberOfConnections()));
            }
        }
        return results;
    }
View Full Code Here

     */
    public void resetAllConnections() {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            Iterator enumtr = ((ServerSession)getSession()).getConnectionPools().values().iterator();
            while (enumtr.hasNext()) {
                ConnectionPool pool = (ConnectionPool)enumtr.next();
                pool.shutDown();
                pool.startUp();
            }
        } else if (ClassConstants.PublicInterfaceDatabaseSession_Class.isAssignableFrom(getSession().getClass())) {
            getSession().getAccessor().reestablishConnection(getSession());
        }
    }
View Full Code Here

     * @param poolName the name of the pool to get the max size for
     * @return Integer for the max size of the pool. Return -1 if pool doesn't exist.
     */
     public Integer getMaxSizeForPool(String poolName) {
         if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
             ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
             if (connectionPool != null) {
                 return Integer.valueOf(connectionPool.getMaxNumberOfConnections());
             }
         }
         return Integer.valueOf(-1);
     }
View Full Code Here

     * @param poolName the name of the pool to get the min size for
     * @return Integer for the min size of the pool. Return -1 if pool doesn't exist.
     */
     public Integer getMinSizeForPool(String poolName) {
         if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
             ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
             if (connectionPool != null) {
                 return Integer.valueOf(connectionPool.getMinNumberOfConnections());
             }
         }
         return Integer.valueOf(-1);
     }
View Full Code Here

    /**
     * INTERNAL:
     * Return an accessor from the pool.
     */
    public Accessor acquireAccessor(String poolName, ServerSession session, DatabaseQuery query, boolean returnNullIfDead) {
        ConnectionPool pool = session.getConnectionPool(poolName);
        if (pool == null) {
            throw QueryException.missingConnectionPool(poolName, query);
        }
        if (returnNullIfDead && pool.isDead()) {
            return null;
        }
        return pool.acquireConnection();
    }
View Full Code Here

            String shared = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_READ_CONNECTIONS_SHARED, m, session);
            boolean isShared = false;
            if (shared != null) {
                isShared = Boolean.parseBoolean(shared);
            }           
            ConnectionPool pool = null;
            if (isShared) {
                pool = new ReadConnectionPool("read", this.session.getReadConnectionPool().getLogin(), this.session);
            } else {
                pool = new ConnectionPool("read", this.session.getReadConnectionPool().getLogin(), this.session);
            }
            String min = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_READ_CONNECTIONS_MIN, m, session);
            if (min != null) {
                pool.setMinNumberOfConnections(Integer.parseInt(min));
            }
            String max = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_READ_CONNECTIONS_MAX, m, session);
            if (max != null) {
                pool.setMaxNumberOfConnections(Integer.parseInt(max));
            }
            String initial = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_READ_CONNECTIONS_INITIAL, m, session);
            if (initial != null) {
                pool.setInitialNumberOfConnections(Integer.parseInt(initial));
            }
            // Only set the read pool if they configured it, otherwise use default shared read/write.
            if (isShared || (min != null) || (max != null) || (initial != null)) {
                this.session.setReadConnectionPool(pool);
            }
            String wait = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_CONNECTIONS_WAIT, m, session);
            if (wait != null) {
                session.getDefaultConnectionPool().setWaitTimeout(Integer.parseInt(wait));
                pool.setWaitTimeout(Integer.parseInt(wait));
            }
        }
       
        // Configure sequence connection pool if set.
        String sequence = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_SEQUENCE_CONNECTION_POOL, m, session);
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.sessions.server.ConnectionPool

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.