/** * 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(); }
/** * 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); } }