public String getConnectionCacheName() throws SQLException { return dataSource.getConnectionCacheName(); }
/** * Equality is defined in terms of the serverName, portNumber and databaseName properties * */ public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof LocalRACMCF) { try { OracleDataSource other = ((LocalRACMCF) obj).dataSource; return equals(dataSource.getURL(), other.getURL()) && equals(dataSource.getConnectionCacheName(), other.getConnectionCacheName()); } catch (SQLException e) { return false; } } else { return false; } }
public int hashCode() { try { return hashCode(dataSource.getURL()) ^ hashCode(dataSource.getConnectionCacheName()); } catch (SQLException e) { return 0; } }
@Override public DataSourceInfo getInfo(Object resource) throws Exception { DataSourceInfo dataSourceInfo = null; if (canMap(resource)) { OracleDataSource source = (OracleDataSource) resource; OracleConnectionCacheManager occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance(); Properties cacheProperties = source.getConnectionCacheProperties(); String cacheName = source.getConnectionCacheName(); cacheName = cacheName != null && occm.existsCache(cacheName) ? cacheName : null; if (cacheProperties != null) { dataSourceInfo = new DataSourceInfo(); if (cacheName != null) { dataSourceInfo.setBusyConnections(occm.getNumberOfActiveConnections(cacheName)); dataSourceInfo.setEstablishedConnections(occm.getNumberOfAvailableConnections(cacheName) + dataSourceInfo.getBusyConnections()); } else { dataSourceInfo.setBusyConnections(0); dataSourceInfo.setEstablishedConnections(0); } dataSourceInfo.setMaxConnections(UtilsBase.toInt(cacheProperties.getProperty("MaxLimit"), -1)); dataSourceInfo.setJdbcUrl(source.getURL()); dataSourceInfo.setUsername(source.getUser()); dataSourceInfo.setResettable(true); dataSourceInfo.setType("oracle-jdbc"); } } return dataSourceInfo; }