@ManagementOperation(description = "The total number of available connections in the pool") public int poolTotalSize() throws AtomikosSQLException { delegate.init(); return delegate.poolTotalSize(); }
public void close() throws HibernateException { if (dataSource != null) dataSource.close(); dataSource = null; }
@ManagementOperation(description = "The minimum connection pool size") public int getMinPoolSize() { return delegate.getMinPoolSize(); }
@ManagementOperation(description = "The approximate number of available connections in the pool") public int poolAvailableSize() throws AtomikosSQLException { delegate.init(); return delegate.poolAvailableSize(); }
return; if ( maxPoolSize < 1 ) throwAtomikosSQLException ( "Property 'maxPoolSize' must be greater than 0, was: " + maxPoolSize ); if ( minPoolSize < 0 || minPoolSize > maxPoolSize ) throwAtomikosSQLException("Property 'minPoolSize' must be at least 0 and at most maxPoolSize, was: " + minPoolSize); if ( getUniqueResourceName() == null ) throwAtomikosSQLException("Property 'uniqueResourceName' cannot be null"); if ( getMinPoolSize() == DEFAULT_POOL_SIZE ) { LOGGER.logWarning ( this + ": poolSize equals default - this may cause performance problems!" ); ConnectionFactory cf = doInit(); if (enableConcurrentConnectionValidation) { connectionPool = new ConnectionPoolWithConcurrentValidation(cf, this); } else { if ( getTestQuery() != null ) LOGGER.logWarning ( this + ": testQuery set - pool may be slower / you might want to consider setting maxLifetime instead..." ); connectionPool = new ConnectionPoolWithSynchronizedValidation(cf, this); getReference();
public Connection getConnection() throws SQLException { if ( LOGGER.isDebugEnabled() ) LOGGER.logDebug ( this + ": getConnection()..." ); Connection connection = null; init(); try { connection = (Connection) connectionPool.borrowConnection(); } catch (CreateConnectionException ex) { throwAtomikosSQLException("Failed to grow the connection pool", ex); } catch (PoolExhaustedException e) { throwAtomikosSQLException ("Connection pool exhausted - try increasing 'maxPoolSize' and/or 'borrowConnectionTimeout' on the DataSourceBean."); } catch (ConnectionPoolException e) { throwAtomikosSQLException("Error borrowing connection", e ); } if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( this + ": returning " + connection ); return connection; }
public Reference getReference() throws NamingException { return IntraVmObjectFactory.createReference ( this , getUniqueResourceName() ); }
public void close() { if ( LOGGER.isDebugEnabled() ) LOGGER.logInfo ( this + ": close..." ); if (connectionPool != null) { connectionPool.destroy(); } connectionPool = null; doClose(); try { IntraVmObjectRegistry.removeResource ( getUniqueResourceName() ); } catch ( NameNotFoundException e ) { //ignore but log if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( this + ": Error removing from JNDI" , e ); } if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( this + ": close done." ); }
public void configure(Properties props) throws HibernateException { if (dataSource != null) { return; } if ("true".equalsIgnoreCase(props.getProperty(PROPERTY_NONXA))) { dataSource = new AtomikosNonXADataSourceBean(); } else { dataSource = new AtomikosDataSourceBean(); } Properties atomikosProperties = filterOutHibernateProperties(props); LOGGER.logInfo("configuring AtomikosConnectionProvider with properties: " + atomikosProperties); try { PropertyUtils.setProperties(dataSource, atomikosProperties); } catch (PropertyException ex) { throw new HibernateException("cannot create Atomikos DataSource", ex); } try { dataSource.init(); } catch (AtomikosSQLException ex) { throw new HibernateException("cannot initialize Atomikos DataSource", ex); } }
@ManagementOperation(description = "The SQL query used to test a connection before returning it") public String getTestQuery() { return delegate.getTestQuery(); }
public Connection getConnection(String username, String password) throws SQLException { LOGGER.logWarning ( this + ": getConnection ( user , password ) ignores authentication - returning default connection" ); return getConnection(); }
@ManagementOperation(description = "The maximum amount of time in seconds the pool will block waiting for a connection to become available in the pool when it is empty") public int getBorrowConnectionTimeout() { return delegate.getBorrowConnectionTimeout(); }
@ManagementOperation(description = "The maintenance interval for the pool maintenance thread") public int getMaintenanceInterval() { return delegate.getMaintenanceInterval(); }
@ManagementOperation(description = "The maximum amount of time in seconds a connection can stay in the pool before being eligible for being closed during pool shrinking") public int getMaxIdleTime() { return delegate.getMaxIdleTime(); }
@ManagementOperation(description = "The login timeout") public int getLoginTimeout() throws SQLException { return delegate.getLoginTimeout(); }
@ManagementOperation(description = "The approximate number of available connections in the pool") public int poolAvailableSize() throws AtomikosSQLException { delegate.init(); return delegate.poolAvailableSize(); }
private void unRegisterManagement(AbstractDataSourceBean bean) throws Fabric3Exception { String name = bean.getUniqueResourceName(); managementService.remove(encode(name), "datasources"); }
@ManagementOperation(description = "The SQL query used to test a connection before returning it") public String getTestQuery() { return delegate.getTestQuery(); }
public Connection getConnection() throws SQLException { if (dataSource == null) throw new HibernateException("datasource is not configured"); return dataSource.getConnection(); }
@ManagementOperation(description = "The maximum amount of time in seconds the pool will block waiting for a connection to become available in the pool when it is empty") public int getBorrowConnectionTimeout() { return delegate.getBorrowConnectionTimeout(); }