private void setPoolProperties(final AtomikosDataSourceBean dataSourceBean, final YamlDataSourceParameter parameter) { dataSourceBean.setMaintenanceInterval((int) (parameter.getMaintenanceIntervalMilliseconds() / 1000)); dataSourceBean.setMinPoolSize(parameter.getMinPoolSize() < 0 ? 0 : parameter.getMinPoolSize()); dataSourceBean.setMaxPoolSize(parameter.getMaxPoolSize()); dataSourceBean.setBorrowConnectionTimeout((int) parameter.getConnectionTimeoutMilliseconds() / 1000); dataSourceBean.setReapTimeout((int) parameter.getMaxLifetimeMilliseconds() / 1000); dataSourceBean.setMaxIdleTime((int) parameter.getIdleTimeoutMilliseconds() / 1000); }
@Override public DataSource build(final String dataSourceName, final YamlDataSourceParameter dataSourceParameter) throws Exception { AtomikosDataSourceBean result = new AtomikosDataSourceBean(); setPoolProperties(result, dataSourceParameter); setXAProperties(result, dataSourceName, XADataSourceFactory.build(DatabaseType.MySQL), dataSourceParameter); return result; }
private void setXAProperties(final AtomikosDataSourceBean dataSourceBean, final String dataSourceName, final XADataSource xaDataSource, final YamlDataSourceParameter dataSourceParameter) throws PropertyException { dataSourceBean.setXaDataSourceClassName(xaDataSource.getClass().getName()); dataSourceBean.setUniqueResourceName(dataSourceName); Properties xaProperties = XAPropertiesFactory.createXAProperties(JDBCURLRecognizerEngine.getDatabaseType(dataSourceParameter.getUrl())).build( new DatabaseAccessConfiguration(dataSourceParameter.getUrl(), dataSourceParameter.getUsername(), dataSourceParameter.getPassword())); PropertyUtils.setProperties(xaDataSource, xaProperties); dataSourceBean.setXaProperties(xaProperties); dataSourceBean.setXaDataSource(xaDataSource); } }
atomikosDataSourceBean.setXaDataSource(dataSource); atomikosDataSourceBean.setXaDataSourceClassName(getXaDataSourceClassName()); atomikosDataSourceBean.setBorrowConnectionTimeout(getBorrowConnectionTimeout()); if (loginTimeout != 0) { try { atomikosDataSourceBean.setLoginTimeout(getLoginTimeout()); } catch (SQLException e) { log.warn(e.getMessage(), e); atomikosDataSourceBean.setMaxIdleTime(getMaxIdleTime()); atomikosDataSourceBean.setMaxPoolSize(getMaxPoolSize()); atomikosDataSourceBean.setMinPoolSize(getMinPoolSize()); atomikosDataSourceBean.setDefaultIsolationLevel(getDefaultIsolationLevel()); atomikosDataSourceBean.setMaintenanceInterval(getMaintenanceInterval()); atomikosDataSourceBean.setReapTimeout(getReapTimeout()); atomikosDataSourceBean.setTestQuery(getTestQuery()); atomikosDataSourceBean.setXaProperties(getXaProperties()); atomikosDataSourceBean.setMaxLifetime(getMaxLifetime());
public Connection getConnection () throws SQLException { checkSetup (); return ds_.getConnection (); }
/** * @see com.atomikos.jdbc.HeuristicDataSource#getConnection(com.atomikos.icatch.HeuristicMessage) */ public Connection getConnection ( HeuristicMessage msg ) throws SQLException { DTPPooledConnection ret = (DTPPooledConnection) pool_ .getPooledConnection (); ret.addConnectionEventListener ( this ); return ret.getConnection ( msg ); }
public void setLogWriter ( PrintWriter out ) throws SQLException { checkSetup (); ds_.setLogWriter ( out ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection () throws SQLException { checkSetup (); return ds_.getConnection (); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public void setLoginTimeout ( int seconds ) throws SQLException { checkSetup (); ds_.setLoginTimeout ( seconds ); }
public PrintWriter getLogWriter () throws SQLException { checkSetup (); return ds_.getLogWriter (); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public int getLoginTimeout () throws SQLException { checkSetup (); return ds_.getLoginTimeout (); }
public int getLoginTimeout () throws SQLException { checkSetup (); return ds_.getLoginTimeout (); }
public void setLoginTimeout ( int seconds ) throws SQLException { checkSetup (); ds_.setLoginTimeout ( seconds ); }
private void setPoolProperties(final AtomikosDataSourceBean dataSourceBean, final YamlDataSourceParameter parameter) { dataSourceBean.setMaintenanceInterval((int) (parameter.getMaintenanceIntervalMilliseconds() / 1000)); dataSourceBean.setMinPoolSize(parameter.getMinPoolSize() < 0 ? 0 : parameter.getMinPoolSize()); dataSourceBean.setMaxPoolSize(parameter.getMaxPoolSize()); dataSourceBean.setBorrowConnectionTimeout((int) parameter.getConnectionTimeoutMilliseconds() / 1000); dataSourceBean.setReapTimeout((int) parameter.getMaxLifetimeMilliseconds() / 1000); dataSourceBean.setMaxIdleTime((int) parameter.getIdleTimeoutMilliseconds() / 1000); }
private void setXAProperties(final AtomikosDataSourceBean dataSourceBean, final String dataSourceName, final XADataSource xaDataSource, final YamlDataSourceParameter dataSourceParameter) throws PropertyException { dataSourceBean.setXaDataSourceClassName(xaDataSource.getClass().getName()); dataSourceBean.setUniqueResourceName(dataSourceName); Properties xaProperties = XAPropertiesFactory.createXAProperties(JDBCURLRecognizerEngine.getDatabaseType(dataSourceParameter.getUrl())).build( new DatabaseAccessConfiguration(dataSourceParameter.getUrl(), dataSourceParameter.getUsername(), dataSourceParameter.getPassword())); PropertyUtils.setProperties(xaDataSource, xaProperties); dataSourceBean.setXaProperties(xaProperties); dataSourceBean.setXaDataSource(xaDataSource); } }
@Override public DataSource build(final String dataSourceName, final YamlDataSourceParameter dataSourceParameter) throws Exception { AtomikosDataSourceBean result = new AtomikosDataSourceBean(); setPoolProperties(result, dataSourceParameter); setXAProperties(result, dataSourceName, XADataSourceFactory.build(DatabaseType.PostgreSQL), dataSourceParameter); return result; }
public Connection getConnection ( String user , String pw , HeuristicMessage msg ) throws SQLException { checkSetup (); return ds_.getConnection ( user, pw, msg ); }
public Connection getConnection ( String user , String passwd , String msg ) throws SQLException { checkSetup (); return ds_.getConnection ( user, passwd, msg ); }
public Connection getConnection ( String user , String pw ) throws SQLException { checkSetup (); return ds_.getConnection ( user, pw ); }
public Connection getConnection ( HeuristicMessage msg ) throws SQLException { checkSetup (); return ds_.getConnection ( msg ); }