Permalink
Browse files

Prepare 2.5.0 release (Java 8 only)

  • Loading branch information...
1 parent 03122e8 commit cce7c9133d6cba20ba7f693352c37c31fd8a5067 @brettwooldridge committed Aug 14, 2016
View
@@ -10,6 +10,4 @@ install: /bin/true
script:
- mvn install -Dskip.unit.tests=true -Dmaven.javadoc.skip=true -V -B
- - mvn clean test coveralls:report -V -P coverage
- - jdk_switcher use openjdk7
- - mvn test
+ - mvn test coveralls:report -V -P coverage
View
@@ -3,7 +3,7 @@
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
- <version>2.4.8-SNAPSHOT</version>
+ <version>2.5.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>HikariCP</name>
@@ -16,9 +16,6 @@
package com.zaxxer.hikari.util;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;
@@ -49,22 +46,13 @@
{
public static Sequence create()
{
- if (UtilityElf.isJdk8Plus() && !Boolean.getBoolean("com.zaxxer.hikari.useAtomicLongSequence")) {
+ if (!Boolean.getBoolean("com.zaxxer.hikari.useAtomicLongSequence")) {
return new Java8Sequence();
}
else {
- try {
- Class<?> longAdderClass = Sequence.class.getClassLoader().loadClass("com.codahale.metrics.LongAdder");
- return new DropwizardSequence(longAdderClass);
- }
- catch (Exception e2) {
- // fall thru
- }
+ return new Java7Sequence();
}
-
- return new Java7Sequence();
}
-
}
final class Java7Sequence extends AtomicLong implements Sequence {
@@ -80,42 +68,4 @@ public long get() {
return this.sum();
}
}
-
- final class DropwizardSequence implements Sequence {
- private final Object longAdder;
- private final Method increment;
- private final Method sum;
-
- public DropwizardSequence(Class<?> longAdderClass) throws Exception {
- Constructor<?> constructor = longAdderClass.getDeclaredConstructors()[0];
- constructor.setAccessible(true);
- increment = longAdderClass.getMethod("increment");
- increment.setAccessible(true);
- sum = longAdderClass.getMethod("sum");
- sum.setAccessible(true);
- longAdder = constructor.newInstance();
- }
-
- @Override
- public void increment()
- {
- try {
- increment.invoke(longAdder);
- }
- catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public long get()
- {
- try {
- return (Long) sum.invoke(longAdder);
- }
- catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- }
}
@@ -26,8 +26,6 @@
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
*
@@ -154,20 +152,6 @@ public static int getTransactionIsolation(final String transactionIsolationName)
return -1;
}
- /**
- * Are we running on JDK 8 or above?
- *
- * @return true if JDK 8+, false otherwise
- */
- public static boolean isJdk8Plus() {
- Matcher matcher = Pattern.compile("(?:(\\d+(?:\\.?\\d*)))").matcher(System.getProperty("java.version"));
- if (!matcher.find()) {
- return false;
- }
-
- return Float.parseFloat(matcher.group(1)) > 1.7f;
- }
-
public static final class DefaultThreadFactory implements ThreadFactory {
private final String threadName;

0 comments on commit cce7c91

Please sign in to comment.