public synchronized Object makeObject() { Object obj; try { PooledConnection pc = null; if (_username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(_username, _password); } if (pc == null) { throw new IllegalStateException("Connection pool data source returned null from getPooledConnection"); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, _username, _password); pcMap.put(pc, obj); } catch (SQLException e) { throw new RuntimeException(e.getMessage()); } return obj; }
public synchronized Object makeObject() { Object obj; try { PooledConnection pc = null; if (_username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(_username, _password); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, _username, _password); pcMap.put(pc, obj); } catch (SQLException e) { throw new RuntimeException(e.getMessage()); } return obj; }
public synchronized Object makeObject() { Object obj; try { PooledConnection pc = null; if (_username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(_username, _password); } if (pc == null) { throw new IllegalStateException("Connection pool data source returned null from getPooledConnection"); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, _username, _password); pcMap.put(pc, obj); } catch (SQLException e) { throw new RuntimeException(e.getMessage()); } return obj; }
/** * Creates a new {@link PooledConnectionAndInfo} from the given {@link UserPassKey}. * * @param key {@link UserPassKey} containing user credentials * @throws SQLException if the connection could not be created. * @see org.apache.commons.pool.KeyedPoolableObjectFactory#makeObject(java.lang.Object) */ public synchronized Object makeObject(Object key) throws Exception { Object obj = null; UserPassKey upkey = (UserPassKey)key; PooledConnection pc = null; String username = upkey.getUsername(); String password = upkey.getPassword(); if (username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(username, password); } if (pc == null) { throw new IllegalStateException("Connection pool data source returned null from getPooledConnection"); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, username, password); pcMap.put(pc, obj); return obj; }
/** * Creates a new {@link PooledConnectionAndInfo} from the given {@link UserPassKey}. * * @param key {@link UserPassKey} containing user credentials * @throws SQLException if the connection could not be created. * @see org.apache.commons.pool.KeyedPoolableObjectFactory#makeObject(java.lang.Object) */ public synchronized Object makeObject(Object key) throws Exception { Object obj = null; UserPassKey upkey = (UserPassKey)key; PooledConnection pc = null; String username = upkey.getUsername(); String password = upkey.getPassword(); if (username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(username, password); } if (pc == null) { throw new IllegalStateException("Connection pool data source returned null from getPooledConnection"); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, username, password); pcMap.put(pc, obj); return obj; }
/** * @param key * @throws SQLException if the connection could not be created. * @see org.apache.commons.pool.KeyedPoolableObjectFactory#makeObject(java.lang.Object) */ public synchronized Object makeObject(Object key) throws Exception { Object obj = null; UserPassKey upkey = (UserPassKey)key; PooledConnection pc = null; String username = upkey.getUsername(); String password = upkey.getPassword(); if (username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(username, password); } // should we add this object as a listener or the pool. // consider the validateObject method in decision pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, username, password); pcMap.put(pc, obj); return obj; }