Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Supplier;

import org.neo4j.driver.Logger;
import org.neo4j.driver.Logging;
Expand All @@ -54,6 +52,8 @@
import static org.neo4j.driver.internal.async.connection.ChannelAttributes.setAuthorizationStateListener;
import static org.neo4j.driver.internal.util.Futures.combineErrors;
import static org.neo4j.driver.internal.util.Futures.completeWithNullIfNoError;
import static org.neo4j.driver.internal.util.LockUtil.executeWithLock;
import static org.neo4j.driver.internal.util.LockUtil.executeWithLockAsync;

public class ConnectionPoolImpl implements ConnectionPool
{
Expand Down Expand Up @@ -342,34 +342,4 @@ private CompletableFuture<Void> closeAllPools()
} )
.toArray( CompletableFuture[]::new ) );
}

private void executeWithLock( Lock lock, Runnable runnable )
{
executeWithLock( lock, () ->
{
runnable.run();
return null;
} );
}

private <T> T executeWithLock( Lock lock, Supplier<T> supplier )
{
lock.lock();
try
{
return supplier.get();
}
finally
{
lock.unlock();
}
}

private <T> void executeWithLockAsync( Lock lock, Supplier<CompletionStage<T>> stageSupplier )
{
lock.lock();
CompletableFuture.completedFuture( lock )
.thenCompose( ignored -> stageSupplier.get() )
.whenComplete( ( ignored, throwable ) -> lock.unlock() );
}
}
113 changes: 0 additions & 113 deletions driver/src/main/java/org/neo4j/driver/internal/cluster/AddressSet.java

This file was deleted.

Loading