implementation for the list of the idle connections. The default value is <code>false</code>.
</p>
</attribute>
-
+ <attribute name="useEquals" required="false">
+ <p>(boolean) Set to true if you wish the <code>ProxyConnection</code> class to use <code>String.equals</code> instead of
+ <code>==</code> when comparing method names. This property does not apply to added interceptors as those are configured individually.
+ The default value is <code>false</code>.
+ </p>
</attributes>
</subsection>
</section>
JdbcInterceptor handler = con.getHandler();
if (handler==null) {
//build the proxy handler
- handler = new ProxyConnection(this,con);
+ handler = new ProxyConnection(this,con,getPoolProperties().isUseEquals());
//set up the interceptor chain
PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray();
for (int i=proxies.length-1; i>=0; i--) {
protected final static String PROP_JMX_ENABLED = "jmxEnabled";
protected final static String PROP_FAIR_QUEUE = "fairQueue";
+ protected static final String PROP_USE_EQUALS = "useEquals";
+
public static final int UNKNOWN_TRANSACTIONISOLATION = -1;
PROP_INITSQL,
PROP_INTERCEPTORS,
PROP_JMX_ENABLED,
- PROP_FAIR_QUEUE
+ PROP_FAIR_QUEUE,
+ PROP_USE_EQUALS
};
// -------------------------------------------------- ObjectFactory Methods
dataSource.getPoolProperties().setFairQueue(Boolean.parseBoolean(value));
}
+ value = properties.getProperty(PROP_USE_EQUALS);
+ if (value != null) {
+ dataSource.getPoolProperties().setUseEquals(Boolean.parseBoolean(value));
+ }
+
// Return the configured DataSource instance
DataSource ds = getDataSource(dataSource);
throw new RuntimeException(x);
}
}
+
+ public void setUseEquals(boolean useEquals) {
+ this.getPoolProperties().setUseEquals(useEquals);
+ }
}
protected boolean testOnConnect =false;
private String jdbcInterceptors=null;
private boolean fairQueue = false;
+ private boolean useEquals = false;
private InterceptorDefinition[] interceptors = null;
return result;
}
+
+
public static class InterceptorDefinition {
protected String className;
protected List<InterceptorProperty> properties = new ArrayList<InterceptorProperty>();
}
}
+ public boolean isUseEquals() {
+ return useEquals;
+ }
+
+ public void setUseEquals(boolean useEquals) {
+ this.useEquals = useEquals;
+ }
+
}
this.pool = pool;
}
- protected ProxyConnection(ConnectionPool parent, PooledConnection con) throws SQLException {
+ protected ProxyConnection(ConnectionPool parent, PooledConnection con, boolean useEquals) throws SQLException {
pool = parent;
connection = con;
+ setUseEquals(useEquals);
}
public void reset(ConnectionPool parent, PooledConnection con) {
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (ISCLOSED_VAL==method.getName()) {
+ if (compare(ISCLOSED_VAL,method)) {
return isClosed();
}
- if (CLOSE_VAL==method.getName()) {
+ if (compare(CLOSE_VAL,method)) {
if (isClosed()) return null; //noop for already closed.
PooledConnection poolc = this.connection;
this.connection = null;
pool.returnConnection(poolc);
return null;
- } else if (TOSTRING_VAL==method.getName()) {
+ } else if (compare(TOSTRING_VAL,method)) {
return this.toString();
}
if (isClosed()) throw new SQLException("Connection has already been closed.");