diff options
Diffstat (limited to 'src/main/java/com/zaxxer/hikari/pool/PoolEntry.java')
-rw-r--r-- | src/main/java/com/zaxxer/hikari/pool/PoolEntry.java | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolEntry.java b/src/main/java/com/zaxxer/hikari/pool/PoolEntry.java index 5b16047..2b45256 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolEntry.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolEntry.java @@ -15,22 +15,18 @@ */ package com.zaxxer.hikari.pool; -import static com.zaxxer.hikari.util.ClockSource.currentTime; -import static com.zaxxer.hikari.util.ClockSource.elapsedDisplayString; -import static com.zaxxer.hikari.util.ClockSource.elapsedMillis; +import com.zaxxer.hikari.util.ConcurrentBag.IConcurrentBagEntry; +import com.zaxxer.hikari.util.FastList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import java.util.Comparator; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.zaxxer.hikari.util.ConcurrentBag.IConcurrentBagEntry; -import com.zaxxer.hikari.util.FastList; +import static com.zaxxer.hikari.util.ClockSource.*; /** * Entry used in the ConcurrentBag to track Connection instances. @@ -42,12 +38,12 @@ final class PoolEntry implements IConcurrentBagEntry private static final Logger LOGGER = LoggerFactory.getLogger(PoolEntry.class); private static final AtomicIntegerFieldUpdater<PoolEntry> stateUpdater; - static final Comparator<PoolEntry> LASTACCESS_REVERSE_COMPARABLE; - Connection connection; long lastAccessed; long lastBorrowed; - private volatile int state; + + @SuppressWarnings("FieldCanBeLocal") + private volatile int state = 0; private volatile boolean evict; private volatile ScheduledFuture<?> endOfLife; @@ -60,13 +56,6 @@ final class PoolEntry implements IConcurrentBagEntry static { - LASTACCESS_REVERSE_COMPARABLE = new Comparator<PoolEntry>() { - @Override - public int compare(final PoolEntry entryOne, final PoolEntry entryTwo) { - return Long.compare(entryTwo.lastAccessed, entryOne.lastAccessed); - } - }; - stateUpdater = AtomicIntegerFieldUpdater.newUpdater(PoolEntry.class, "state"); } @@ -94,7 +83,9 @@ final class PoolEntry implements IConcurrentBagEntry } /** - * @param endOfLife + * Set the end of life {@link ScheduledFuture}. + * + * @param endOfLife this PoolEntry/Connection's end of life {@link ScheduledFuture} */ void setFutureEol(final ScheduledFuture<?> endOfLife) { |