/** * Used for load balancing and external pooling. */ public synchronized void decrementCallCount() { setCallCount(getCallCount() - 1); if (usesExternalConnectionPooling() && (!isInTransaction()) && (getCallCount() == 0)) { try { closeConnection(); } catch (DatabaseException ignore) { } // Don't allow for errors to be masked by disconnect. } }
/** * Used for load balancing and external pooling. */ public synchronized void incrementCallCount(AbstractSession session) { setCallCount(getCallCount() + 1); if (getCallCount() == 1) { // If the login is null, then this accessor has never been connected. if (getLogin() == null) { throw DatabaseException.databaseAccessorNotConnected(); } // If the connection is no longer connected, it may have timed out. if (getDatasourceConnection() != null) { if (!isConnected()) { if (isInTransaction()) { throw DatabaseException.databaseAccessorNotConnected(); } else { reconnect(session); } } } else { // If ExternalConnectionPooling is used, the connection can be re-established. if (usesExternalConnectionPooling()) { reconnect(session); } else { throw DatabaseException.databaseAccessorNotConnected(); } } } }