*/
public Future<Connection> getConnectionAsync() throws SQLException {
//we can only retrieve a future if the underlying queue supports it.
- if (idle instanceof FairBlockingQueue) {
+ if (idle instanceof FairBlockingQueue<?>) {
Future<PooledConnection> pcf = ((FairBlockingQueue<PooledConnection>)idle).pollAsync();
return new ConnectionFuture(pcf);
- } else if (idle instanceof MultiLockFairBlockingQueue) {
+ } else if (idle instanceof MultiLockFairBlockingQueue<?>) {
Future<PooledConnection> pcf = ((MultiLockFairBlockingQueue<PooledConnection>)idle).pollAsync();
return new ConnectionFuture(pcf);
} else {
}
}
+ @Override
public void run() {
while (run) {
try {
else return p.getSize();
}
+ @Override
public String toString() {
return super.toString()+"{"+getPoolProperties()+"}";
}
waiters.addLast(c);
lock.unlock();
//return a future that will wait for the object
- result = new ItemFuture(c);
+ result = new ItemFuture<E>(c);
} else {
lock.unlock();
//return a future with the item
- result = new ItemFuture(item);
+ result = new ItemFuture<E>(item);
}
error = false;
} finally {
waiters[idx].addLast(c);
lock.unlock();
//return a future that will wait for the object
- result = new ItemFuture(c);
+ result = new ItemFuture<E>(c);
} else {
lock.unlock();
//return a future with the item
- result = new ItemFuture(item);
+ result = new ItemFuture<E>(item);
}
error = false;
} finally {
* {@inheritDoc}
*/
public boolean addAll(Collection<? extends E> c) {
- Iterator i = c.iterator();
+ Iterator<? extends E> i = c.iterator();
while (i.hasNext()) {
- E e = (E)i.next();
+ E e = i.next();
offer(e);
}
return true;
this.interceptors = null;
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer("ConnectionPool[");
try {
public String getValue() {
return value;
}
+ @Override
public int hashCode() {
return name.hashCode();
}
+ @Override
public boolean equals(Object o) {
if (o==this) return true;
if (o instanceof InterceptorProperty) {
*
* @return true if the connection was validated successfully. It returns true even if validation was not performed, such as when
* {@link PoolConfiguration#setValidationInterval(long)} has been called with a positive value.
- * @return false if the validation failed. The caller should close the connection if false is returned since a session could have been left in
+ * <p>
+ * false if the validation failed. The caller should close the connection if false is returned since a session could have been left in
* an unknown state during initialization.
*/
public boolean validate(int validateAction,String sql) {
Statement stmt = null;
try {
stmt = connection.createStatement();
- boolean exec = stmt.execute(query);
+ stmt.execute(query);
stmt.close();
this.lastValidated = now;
return true;
this.handler = handler;
}
+ @Override
public String toString() {
return "PooledConnection["+(connection!=null?connection.toString():"null")+"]";
}
setUseEquals(useEquals);
}
+ @Override
public void reset(ConnectionPool parent, PooledConnection con) {
this.pool = parent;
this.connection = con;
}
}
+ @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (compare(ISCLOSED_VAL,method)) {
return Boolean.valueOf(isClosed());
return pool;
}
+ @Override
public String toString() {
return "ProxyConnection["+(connection!=null?connection.toString():"null")+"]";
}
protected String catalog = null;
+ @Override
public void reset(ConnectionPool parent, PooledConnection con) {
if (parent==null || con==null) return;
PoolConfiguration poolProperties = parent.getPoolProperties();
return FIELD_TYPES;
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer("QueryStats[query:");
buf.append(query);
return totalInvocationTime;
}
+ @Override
public int hashCode() {
return query.hashCode();
}
+ @Override
public boolean equals(Object other) {
if (other instanceof QueryStats) {
QueryStats qs = (QueryStats)other;