A little change,AtomicBoolean.
@@ -6,11 +6,12 @@ import org.apache.tomcat.jdbc.pool.PooledConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.AtomicBoolean;
public class DefaultConnectionState extends JdbcInterceptor {
private static final Logger logger = LoggerFactory.getLogger(DefaultConnectionState.class);
- private AtomicReference<Boolean> isFirstTime = new AtomicReference<>(true);
+
+ private AtomicBoolean isFirstTime = new AtomicBoolean(true);
@Override
public void reset(ConnectionPool parent, PooledConnection con) {
@@ -18,7 +19,7 @@ public class DefaultConnectionState extends JdbcInterceptor {
return;
try {
- boolean firstTime = isFirstTime.get().booleanValue();
+ boolean firstTime = isFirstTime.get();
if (!firstTime)
return;
