/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (getDatasourceConnection() != null) { if (isDatasourceConnected()) { closeDatasourceConnection(); } setDatasourceConnection(null); } } catch (DatabaseException exception) { // Ignore setDatasourceConnection(null); } }
/** * Connect to the database. * Exceptions are caught and re-thrown as TopLink exceptions. */ protected void connect(Login login) throws DatabaseException { setDatasourceConnection(login.connectToDatasource(this)); setIsConnected(true); }
/** * 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); } } }
/** * Disconnect from the datasource. */ public void disconnect(AbstractSession session) throws DatabaseException { session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "disconnect", (Object[])null, this); if (getDatasourceConnection() == null) { return; } session.incrementProfile(SessionProfiler.TlDisconnects); session.startOperationProfile(SessionProfiler.CONNECT); closeDatasourceConnection(); setDatasourceConnection(null); setIsInTransaction(false); session.endOperationProfile(SessionProfiler.CONNECT); }
if ((getDatasourceConnection() != null) && usesExternalConnectionPooling()) { closeConnection(); setDatasourceConnection(null);
if ((getDatasourceConnection() != null) && usesExternalConnectionPooling()) { closeConnection(); setDatasourceConnection(null);