Skip to content

Commit

Permalink
Remove our "ported" Java 8 LongAdder and Striped64.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettwooldridge committed May 14, 2015
1 parent c9041c8 commit 230c019
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 712 deletions.
4 changes: 0 additions & 4 deletions pom.xml
Expand Up @@ -179,8 +179,6 @@
<exclude>**/com/zaxxer/hikari/proxy/CallableStatementProxy</exclude>
<exclude>**/com/zaxxer/hikari/proxy/PreparedStatementProxy</exclude>
<exclude>**/com/zaxxer/hikari/pool/PoolInitializationException</exclude>
<exclude>**/com/zaxxer/hikari/util/LongAdder</exclude>
<exclude>**/com/zaxxer/hikari/util/Striped64</exclude>
<exclude>**/com/zaxxer/hikari/metrics/**</exclude>
</excludes>
</configuration>
Expand All @@ -204,8 +202,6 @@
<exclude>**/com/zaxxer/hikari/proxy/CallableStatementProxy.class</exclude>
<exclude>**/com/zaxxer/hikari/proxy/PreparedStatementProxy.class</exclude>
<exclude>**/com/zaxxer/hikari/pool/PoolInitializationException.class</exclude>
<exclude>**/com/zaxxer/hikari/util/LongAdder.class</exclude>
<exclude>**/com/zaxxer/hikari/util/Striped64.class</exclude>
<exclude>**/com/zaxxer/hikari/metrics/**</exclude>
</excludes>
</configuration>
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
Expand Up @@ -61,7 +61,7 @@ public class ConcurrentBag<T extends IConcurrentBagEntry> implements AutoCloseab
private final boolean weakThreadLocal;

private final ThreadLocal<List> threadList;
private final LongAdder sequence;
private final Sequence sequence;
private final IBagStateListener listener;
private volatile boolean closed;

Expand All @@ -78,8 +78,7 @@ public ConcurrentBag(IBagStateListener listener, boolean weakThreadLocal)

this.sharedList = new CopyOnWriteArrayList<>();
this.synchronizer = new Synchronizer();
this.sequence = new LongAdder();
this.sequence.increment();
this.sequence = Sequence.Factory.create();
if (weakThreadLocal) {
this.threadList = new ThreadLocal<>();
}
Expand Down Expand Up @@ -141,13 +140,13 @@ public T borrow(long timeout, final TimeUnit timeUnit) throws InterruptedExcepti
try {
while (timeout > 1000L && synchronizer.tryAcquireSharedNanos(startSeq, timeout)) {
do {
startSeq = sequence.sum();
startSeq = sequence.get();
for (final T bagEntry : sharedList) {
if (bagEntry.state().compareAndSet(STATE_NOT_IN_USE, STATE_IN_USE)) {
return bagEntry;
}
}
} while (startSeq < sequence.sum());
} while (startSeq < sequence.get());

if (addItemFuture == null || addItemFuture.isDone()) {
addItemFuture = listener.addBagItem();
Expand Down Expand Up @@ -349,7 +348,7 @@ private final class Synchronizer extends AbstractQueuedLongSynchronizer
@Override
protected long tryAcquireShared(final long seq)
{
return sequence.sum() - (seq + 1) < 0 ? -1L : 0L;
return sequence.get() - (seq + 1) < 0 ? -1L : 0L;
}

/** {@inheritDoc} */
Expand Down
269 changes: 0 additions & 269 deletions src/main/java/com/zaxxer/hikari/util/LongAdder.java

This file was deleted.

0 comments on commit 230c019

Please sign in to comment.