/** * To be called after JTS transaction has been completed (committed or rolled back) */ public void afterJTSTransaction() { if (usesExternalTransactionController()) { setIsInTransaction(false); if ((getDatasourceConnection() != null) && usesExternalConnectionPooling()) { closeConnection(); setDatasourceConnection(null); } } }
/** * Return true if the accessor is currently connected to a data source. * Return false otherwise. */ public boolean isConnected() { if ((getDatasourceConnection() == null) && (getLogin() == null)) { return false; } if (usesExternalConnectionPooling()) { return true;// As can always reconnect. } if (getDatasourceConnection() == null) { return false; } return isDatasourceConnected(); }
/** * 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(); } } } }
if ((getDatasourceConnection() != null) && usesExternalConnectionPooling()) { closeConnection(); setDatasourceConnection(null);
if ((getDatasourceConnection() != null) && usesExternalConnectionPooling()) { closeConnection(); setDatasourceConnection(null);