better fix

pull/347/head
Nitin 10 years ago
parent 07ca37e7a4
commit dc5b484f52

@ -474,6 +474,7 @@ public class HikariConfig implements HikariConfigMXBean
* @param metricRegistry the Codahale MetricRegistry to set
*/
public void setMetricRegistry(Object metricRegistry)
{
if (metricsTrackerFactory != null) {
throw new IllegalStateException("cannot use setMetricRegistry() and setMetricsTrackerFactory() together");
}

@ -109,23 +109,24 @@ public final class PoolElf
{
if (transactionIsolationName != null) {
try {
int level = Integer.parseInt(transactionIsolationName);
//its number
switch (level) {
case Connection.TRANSACTION_READ_UNCOMMITTED:
case Connection.TRANSACTION_READ_COMMITTED:
case Connection.TRANSACTION_REPEATABLE_READ:
case Connection.TRANSACTION_SERIALIZABLE:
return level;
}
throw new IllegalArgumentException("Invalid transaction isolation value: " + transactionIsolationName);
}
catch (Exception e) {
//its name
}
try {
Field field = Connection.class.getField(transactionIsolationName);
return field.getInt(null);
String upperName = transactionIsolationName.toUpperCase();
if (upperName.startsWith("TRANSACTION_")) {
Field field = Connection.class.getField(transactionIsolationName);
return field.getInt(null);
}
else {
int level = Integer.parseInt(transactionIsolationName);
//its number
switch (level) {
case Connection.TRANSACTION_READ_UNCOMMITTED:
case Connection.TRANSACTION_READ_COMMITTED:
case Connection.TRANSACTION_REPEATABLE_READ:
case Connection.TRANSACTION_SERIALIZABLE:
return level;
}
//invalid level
throw new IllegalArgumentException();
}
}
catch (Exception e) {
throw new IllegalArgumentException("Invalid transaction isolation value: " + transactionIsolationName);

Loading…
Cancel
Save