Skip to content

Commit 77bec1b

Browse files
committed
Replace AddressSet with standard Java collections
1 parent 3b2b564 commit 77bec1b

File tree

13 files changed

+196
-498
lines changed

13 files changed

+196
-498
lines changed

driver/src/main/java/org/neo4j/driver/internal/async/pool/ConnectionPoolImpl.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@
3232
import java.util.concurrent.TimeUnit;
3333
import java.util.concurrent.TimeoutException;
3434
import java.util.concurrent.atomic.AtomicBoolean;
35-
import java.util.concurrent.locks.Lock;
3635
import java.util.concurrent.locks.ReadWriteLock;
3736
import java.util.concurrent.locks.ReentrantReadWriteLock;
38-
import java.util.function.Supplier;
3937

4038
import org.neo4j.driver.Logger;
4139
import org.neo4j.driver.Logging;
@@ -54,6 +52,8 @@
5452
import static org.neo4j.driver.internal.async.connection.ChannelAttributes.setAuthorizationStateListener;
5553
import static org.neo4j.driver.internal.util.Futures.combineErrors;
5654
import static org.neo4j.driver.internal.util.Futures.completeWithNullIfNoError;
55+
import static org.neo4j.driver.internal.util.LockUtil.executeWithLock;
56+
import static org.neo4j.driver.internal.util.LockUtil.executeWithLockAsync;
5757

5858
public class ConnectionPoolImpl implements ConnectionPool
5959
{
@@ -342,34 +342,4 @@ private CompletableFuture<Void> closeAllPools()
342342
} )
343343
.toArray( CompletableFuture[]::new ) );
344344
}
345-
346-
private void executeWithLock( Lock lock, Runnable runnable )
347-
{
348-
executeWithLock( lock, () ->
349-
{
350-
runnable.run();
351-
return null;
352-
} );
353-
}
354-
355-
private <T> T executeWithLock( Lock lock, Supplier<T> supplier )
356-
{
357-
lock.lock();
358-
try
359-
{
360-
return supplier.get();
361-
}
362-
finally
363-
{
364-
lock.unlock();
365-
}
366-
}
367-
368-
private <T> void executeWithLockAsync( Lock lock, Supplier<CompletionStage<T>> stageSupplier )
369-
{
370-
lock.lock();
371-
CompletableFuture.completedFuture( lock )
372-
.thenCompose( ignored -> stageSupplier.get() )
373-
.whenComplete( ( ignored, throwable ) -> lock.unlock() );
374-
}
375345
}

driver/src/main/java/org/neo4j/driver/internal/cluster/AddressSet.java

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)