/** * INTERNAL: * Add the connection as single that a new connection is available. */ public synchronized void releaseConnection(Accessor connection) throws DatabaseException { connection.reset(); this.connectionsUsed.remove(connection); if (!connection.isValid()) { this.owner.setCheckConnections(); try { connection.disconnect(this.owner); } catch (DatabaseException ex) { //this is an invalid connection so expect an exception. } } else { if ((this.connectionsUsed.size() + this.connectionsAvailable.size()) < this.minNumberOfConnections) { this.connectionsAvailable.add(connection); } else { connection.disconnect(getOwner()); } } if (this.owner.isInProfile()) { this.owner.updateProfile(this.name, new Integer(this.connectionsUsed.size())); } notify(); }
if (!connection.isValid()) { this.checkConnections = true; try {
if (!connection.isValid()) { this.checkConnections = true; try {
/** * INTERNAL: * When you release an external connection, you simply let it go. */ public void releaseConnection(Accessor connection) throws DatabaseException { if (this.owner.shouldLog(SessionLog.FINEST, SessionLog.CONNECTION)) { Object[] args = new Object[1]; args[0] = this.name; this.owner.log(SessionLog.FINEST, SessionLog.CONNECTION, "release_connection", args, connection); } if (!this.failoverConnectionPools.isEmpty()) { if (!connection.isValid()) { if (this.checkConnections) { // If 2nd dead connection, then assume dead. this.isDead = true; } else { this.checkConnections = true; } } else { this.checkConnections = false; } } connection.closeConnection(); connection.releaseCustomizer(); }
/** * INTERNAL: * Release any invalid connection in the client session. */ public void releaseInvalidClientSession(ClientSession clientSession) throws DatabaseException { for (Iterator<Accessor> accessors = clientSession.getWriteConnections().values().iterator(); accessors.hasNext(); ) { Accessor accessor = accessors.next(); if (!accessor.isValid()) { if (clientSession.getConnectionPolicy().isPooled()) { try { accessor.getPool().releaseConnection(accessor); } catch (Exception ignore) {} } else { if (!accessor.usesExternalConnectionPooling()) { clientSession.disconnect(accessor); } else { accessor.closeConnection(); } if (this.maxNumberOfNonPooledConnections != NO_MAX) { synchronized (this) { this.numberOfNonPooledConnectionsUsed--; notify(); } } } accessors.remove(); } } }
/** * INTERNAL: * Because connections are not exclusive nothing is required. */ public synchronized void releaseConnection(Accessor connection) throws DatabaseException { connection.decrementCallCount(); if (!connection.isValid()){ getOwner().setCheckConnections(); this.connectionsAvailable.remove(connection); try{ connection.disconnect(getOwner()); }catch (Exception ex){ //ignore } } } }
/** * INTERNAL: * When you release an external connection, you simply let it go. */ public void releaseConnection(Accessor connection) throws DatabaseException { if (this.owner.shouldLog(SessionLog.FINEST, SessionLog.CONNECTION)) { Object[] args = new Object[1]; args[0] = this.name; this.owner.log(SessionLog.FINEST, SessionLog.CONNECTION, "release_connection", args, connection); } if (!this.failoverConnectionPools.isEmpty()) { if (!connection.isValid()) { if (this.checkConnections) { // If 2nd dead connection, then assume dead. this.isDead = true; } else { this.checkConnections = true; } } else { this.checkConnections = false; } } connection.closeConnection(); connection.releaseCustomizer(); }
for (Iterator<Accessor> accessors = clientSession.getWriteConnections().values().iterator(); accessors.hasNext(); ) { Accessor accessor = accessors.next(); if (!accessor.isValid()) { if (clientSession.getConnectionPolicy().isPooled()) { try {
/** * INTERNAL: * Because connections are not exclusive nothing is required. */ public synchronized void releaseConnection(Accessor connection) throws DatabaseException { if (this.owner.shouldLog(SessionLog.FINEST, SessionLog.CONNECTION)) { Object[] args = new Object[1]; args[0] = this.name; this.owner.log(SessionLog.FINEST, SessionLog.CONNECTION, "release_connection", args, connection); } connection.decrementCallCount(); if (!connection.isValid()){ this.checkConnections = true; this.connectionsAvailable.remove(connection); try{ connection.disconnect(getOwner()); }catch (Exception ex){ //ignore } } } }
/** * INTERNAL: * Because connections are not exclusive nothing is required. */ public synchronized void releaseConnection(Accessor connection) throws DatabaseException { if (this.owner.shouldLog(SessionLog.FINEST, SessionLog.CONNECTION)) { Object[] args = new Object[1]; args[0] = this.name; this.owner.log(SessionLog.FINEST, SessionLog.CONNECTION, "release_connection", args, connection); } connection.decrementCallCount(); if (!connection.isValid()){ this.checkConnections = true; this.connectionsAvailable.remove(connection); try{ connection.disconnect(getOwner()); }catch (Exception ex){ //ignore } } } }