Skip to content

Remove unused declarations #1460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -46,8 +46,4 @@ public void updateBookmarks(Set<Bookmark> previousBookmarks, Set<Bookmark> newBo
public Set<Bookmark> getBookmarks() {
return EMPTY;
}

private Set<Bookmark> getAllBookmarks() {
return EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
package org.neo4j.driver.internal.async;

import static java.util.concurrent.CompletableFuture.completedFuture;
import static org.neo4j.driver.internal.async.ConnectionContext.PENDING_DATABASE_NAME_EXCEPTION_SUPPLIER;
import static org.neo4j.driver.internal.util.Futures.completedWithNull;

import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
Expand Down Expand Up @@ -58,11 +56,6 @@
import org.neo4j.driver.internal.util.Futures;

public class NetworkSession {
/**
* Fallback database name used by the driver when session has no database name configured and database discovery is unavailable.
*/
String FALLBACK_DATABASE_NAME = "";

private final ConnectionProvider connectionProvider;
private final NetworkSessionConnectionContext connectionContext;
private final AccessMode mode;
Expand Down Expand Up @@ -393,12 +386,6 @@ private void assertDatabaseNameFutureIsDone() {
}
}

private Optional<String> getDatabaseNameNow() {
return Futures.joinNowOrElseThrow(
connectionContext.databaseNameFuture(), PENDING_DATABASE_NAME_EXCEPTION_SUPPLIER)
.databaseName();
}

/**
* The {@link NetworkSessionConnectionContext#mode} can be mutable for a session connection context
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@
*/
package org.neo4j.driver.internal.async.connection;

import io.netty.channel.Channel;
import org.neo4j.driver.exceptions.AuthorizationExpiredException;

/**
* Listener for authorization info state maintained on the server side.
*/
public interface AuthorizationStateListener {
/**
* Notifies the listener that the credentials stored on the server side have expired.
*
* @param e the {@link AuthorizationExpiredException} exception.
* @param channel the channel that received the error.
*/
void onExpired(AuthorizationExpiredException e, Channel channel);
void onExpired();
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public void handleFailureMessage(String code, String message) {
}

var currentError = this.currentError;
if (currentError instanceof AuthorizationExpiredException authorizationExpiredException) {
authorizationStateListener(channel).onExpired(authorizationExpiredException, channel);
if (currentError instanceof AuthorizationExpiredException) {
authorizationStateListener(channel).onExpired();
} else if (currentError instanceof TokenExpiredException tokenExpiredException) {
var authContext = authContext(channel);
var authTokenProvider = authContext.getAuthTokenManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ public int inUseConnections(ServerAddress address) {
return nettyChannelTracker.inUseChannelCount(address);
}

@Override
public int idleConnections(ServerAddress address) {
private int idleConnections(ServerAddress address) {
return nettyChannelTracker.idleChannelCount(address);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.util.concurrent.atomic.AtomicLong;
import org.neo4j.driver.Logger;
import org.neo4j.driver.Logging;
import org.neo4j.driver.exceptions.AuthorizationExpiredException;
import org.neo4j.driver.internal.async.connection.AuthorizationStateListener;
import org.neo4j.driver.internal.handlers.PingResponseHandler;
import org.neo4j.driver.internal.messaging.request.ResetMessage;
Expand Down Expand Up @@ -124,7 +123,7 @@ private boolean isAuthExpiredByFailure(Channel channel) {
}

@Override
public void onExpired(AuthorizationExpiredException e, Channel channel) {
public void onExpired() {
var now = clock.millis();
minAuthTimestamp.getAndUpdate(prev -> Math.max(prev, now));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public class RoutingSettings {
private final RoutingContext routingContext;
private final long routingTablePurgeDelayMs;

public RoutingSettings(long routingTablePurgeDelayMs) {
this(routingTablePurgeDelayMs, RoutingContext.EMPTY);
}

public RoutingSettings(long routingTablePurgeDelayMs, RoutingContext routingContext) {
this.routingContext = routingContext;
this.routingTablePurgeDelayMs = routingTablePurgeDelayMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ private static RoutingTableRegistry createRoutingTables(
connectionPool, rediscovery, clock, logging, settings.routingTablePurgeDelayMs());
}

private static RuntimeException unknownMode(AccessMode mode) {
return new IllegalArgumentException("Mode '" + mode + "' is not supported");
}

/**
* <b>This method is only for testing</b>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void onFailure(Throwable error) {
ResultSummary summary;
synchronized (this) {
assertRecordAndSummaryConsumerInstalled();
state.onFailure(this, error);
state.onFailure(this);
completionListener.afterFailure(error);
summary = extractResultSummary(emptyMap());
recordConsumer = this.recordConsumer;
Expand All @@ -149,7 +149,7 @@ public void onRecord(Value[] fields) {
Record record = null;
synchronized (this) {
assertRecordAndSummaryConsumerInstalled();
state.onRecord(this, fields);
state.onRecord(this);
newState = state;
if (newState == State.STREAMING_STATE) {
record = new InternalRecord(runResponseHandler.queryKeys(), fields);
Expand Down Expand Up @@ -294,12 +294,12 @@ void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
}

@Override
void onFailure(BasicPullResponseHandler context, Throwable error) {
void onFailure(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

@Override
void onRecord(BasicPullResponseHandler context, Value[] fields) {
void onRecord(BasicPullResponseHandler context) {
context.state(READY_STATE);
}

Expand All @@ -326,12 +326,12 @@ void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
}

@Override
void onFailure(BasicPullResponseHandler context, Throwable error) {
void onFailure(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

@Override
void onRecord(BasicPullResponseHandler context, Value[] fields) {
void onRecord(BasicPullResponseHandler context) {
context.state(STREAMING_STATE);
}

Expand Down Expand Up @@ -360,12 +360,12 @@ void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
}

@Override
void onFailure(BasicPullResponseHandler context, Throwable error) {
void onFailure(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

@Override
void onRecord(BasicPullResponseHandler context, Value[] fields) {
void onRecord(BasicPullResponseHandler context) {
context.state(CANCELLED_STATE);
}

Expand All @@ -388,12 +388,12 @@ void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
}

@Override
void onFailure(BasicPullResponseHandler context, Throwable error) {
void onFailure(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

@Override
void onRecord(BasicPullResponseHandler context, Value[] fields) {
void onRecord(BasicPullResponseHandler context) {
context.state(SUCCEEDED_STATE);
}

Expand All @@ -416,12 +416,12 @@ void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
}

@Override
void onFailure(BasicPullResponseHandler context, Throwable error) {
void onFailure(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

@Override
void onRecord(BasicPullResponseHandler context, Value[] fields) {
void onRecord(BasicPullResponseHandler context) {
context.state(FAILURE_STATE);
}

Expand All @@ -440,9 +440,9 @@ Runnable cancel(BasicPullResponseHandler context) {

abstract void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata);

abstract void onFailure(BasicPullResponseHandler context, Throwable error);
abstract void onFailure(BasicPullResponseHandler context);

abstract void onRecord(BasicPullResponseHandler context, Value[] fields);
abstract void onRecord(BasicPullResponseHandler context);

abstract Runnable request(BasicPullResponseHandler context, long n);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public String toString() {
totalInUseCount());
}

// This method is for testing purposes only
// This is used by the Testkit backend
@SuppressWarnings("unused")
public ServerAddress getAddress() {
return address;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -91,49 +91,106 @@ public class PackStream {
public static final byte FLOAT_64 = (byte) 0xC1;
public static final byte FALSE = (byte) 0xC2;
public static final byte TRUE = (byte) 0xC3;

@SuppressWarnings("unused")
public static final byte RESERVED_C4 = (byte) 0xC4;

@SuppressWarnings("unused")
public static final byte RESERVED_C5 = (byte) 0xC5;

@SuppressWarnings("unused")
public static final byte RESERVED_C6 = (byte) 0xC6;

@SuppressWarnings("unused")
public static final byte RESERVED_C7 = (byte) 0xC7;

public static final byte INT_8 = (byte) 0xC8;
public static final byte INT_16 = (byte) 0xC9;
public static final byte INT_32 = (byte) 0xCA;
public static final byte INT_64 = (byte) 0xCB;
public static final byte BYTES_8 = (byte) 0xCC;
public static final byte BYTES_16 = (byte) 0xCD;
public static final byte BYTES_32 = (byte) 0xCE;

@SuppressWarnings("unused")
public static final byte RESERVED_CF = (byte) 0xCF;

public static final byte STRING_8 = (byte) 0xD0;
public static final byte STRING_16 = (byte) 0xD1;
public static final byte STRING_32 = (byte) 0xD2;

@SuppressWarnings("unused")
public static final byte RESERVED_D3 = (byte) 0xD3;

public static final byte LIST_8 = (byte) 0xD4;
public static final byte LIST_16 = (byte) 0xD5;
public static final byte LIST_32 = (byte) 0xD6;

@SuppressWarnings("unused")
public static final byte RESERVED_D7 = (byte) 0xD7;

public static final byte MAP_8 = (byte) 0xD8;
public static final byte MAP_16 = (byte) 0xD9;
public static final byte MAP_32 = (byte) 0xDA;

@SuppressWarnings("unused")
public static final byte RESERVED_DB = (byte) 0xDB;

public static final byte STRUCT_8 = (byte) 0xDC;
public static final byte STRUCT_16 = (byte) 0xDD;

@SuppressWarnings("unused")
public static final byte RESERVED_DE = (byte) 0xDE;

@SuppressWarnings("unused")
public static final byte RESERVED_DF = (byte) 0xDF;

@SuppressWarnings("unused")
public static final byte RESERVED_E0 = (byte) 0xE0;

@SuppressWarnings("unused")
public static final byte RESERVED_E1 = (byte) 0xE1;

@SuppressWarnings("unused")
public static final byte RESERVED_E2 = (byte) 0xE2;

@SuppressWarnings("unused")
public static final byte RESERVED_E3 = (byte) 0xE3;

@SuppressWarnings("unused")
public static final byte RESERVED_E4 = (byte) 0xE4;

@SuppressWarnings("unused")
public static final byte RESERVED_E5 = (byte) 0xE5;

@SuppressWarnings("unused")
public static final byte RESERVED_E6 = (byte) 0xE6;

@SuppressWarnings("unused")
public static final byte RESERVED_E7 = (byte) 0xE7;

@SuppressWarnings("unused")
public static final byte RESERVED_E8 = (byte) 0xE8;

@SuppressWarnings("unused")
public static final byte RESERVED_E9 = (byte) 0xE9;

@SuppressWarnings("unused")
public static final byte RESERVED_EA = (byte) 0xEA;

@SuppressWarnings("unused")
public static final byte RESERVED_EB = (byte) 0xEB;

@SuppressWarnings("unused")
public static final byte RESERVED_EC = (byte) 0xEC;

@SuppressWarnings("unused")
public static final byte RESERVED_ED = (byte) 0xED;

@SuppressWarnings("unused")
public static final byte RESERVED_EE = (byte) 0xEE;

@SuppressWarnings("unused")
public static final byte RESERVED_EF = (byte) 0xEF;

private static final long PLUS_2_TO_THE_31 = 2147483648L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public interface ConnectionPool {

int inUseConnections(ServerAddress address);

int idleConnections(ServerAddress address);

CompletionStage<Void> close();

boolean isOpen(BoltServerAddress address);
Expand Down
Loading