Skip to content

Commit d2da5dd

Browse files
authored
Migrate to 2023.2.3 inspection engine (#1494)
1 parent 3f78d83 commit d2da5dd

38 files changed

+82
-79
lines changed

driver/src/main/java/org/neo4j/driver/Result.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
* Results are valid until the next query is run or until the end of the current transaction,
3737
* whichever comes first. To keep a result around while further queries are run, or to use a result outside the scope
3838
* of the current transaction, see {@link #list()}.
39-
*
4039
* <h2>Important note on semantics</h2>
4140
*
4241
* In order to handle very large results, and to minimize memory overhead and maximize

driver/src/main/java/org/neo4j/driver/Session.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ default void executeWriteWithoutResult(Consumer<TransactionContext> contextConsu
260260
* This version of run takes a {@link Map} of parameters. The values in the map
261261
* must be values that can be converted to Neo4j types. See {@link Values#parameters(Object...)} for
262262
* a list of allowed types.
263-
*
264263
* <h4>Example</h4>
265264
* <pre>
266265
* {@code

driver/src/main/java/org/neo4j/driver/SimpleQueryRunner.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
/**
2424
* Common interface for components that can execute Neo4j queries.
25-
*
2625
* <h2>Important notes on semantics</h2>
2726
* <p>
2827
* queries run in the same {@link QueryRunner} are guaranteed to execute in order, meaning changes made by one query will be seen by all subsequent queries in
@@ -64,7 +63,6 @@ public interface SimpleQueryRunner {
6463
* send it back as parameters.
6564
* <p>
6665
* If you are creating parameters programmatically, {@link #run(String, Map)} might be more helpful, it converts your map to a {@link Value} for you.
67-
*
6866
* <h4>Example</h4>
6967
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
7068
* {@code
@@ -88,7 +86,6 @@ public interface SimpleQueryRunner {
8886
* <p>
8987
* This version of run takes a {@link Map} of parameters. The values in the map must be values that can be converted to Neo4j types. See {@link
9088
* Values#parameters(Object...)} for a list of allowed types.
91-
*
9289
* <h4>Example</h4>
9390
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
9491
* {@code

driver/src/main/java/org/neo4j/driver/Value.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
* The second set of methods perform coercions to Java types (wherever possible).
5454
* For example, a common String value should be tested for using <code>isString</code>
5555
* and extracted using <code>stringValue</code>.
56-
*
5756
* <h2>Navigating a tree structure</h2>
5857
*
5958
* Because Neo4j often handles dynamic structures, this interface is designed to help

driver/src/main/java/org/neo4j/driver/async/AsyncQueryRunner.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
/**
3232
* Asynchronous interface for components that can execute Neo4j queries.
33-
*
3433
* <h2>Important notes on semantics</h2>
3534
* <p>
3635
* Queries run in the same {@link AsyncQueryRunner} are guaranteed
@@ -62,7 +61,6 @@
6261
* While these semantics introduce some complexity, it gives the driver the ability
6362
* to handle infinite result streams (like subscribing to events), significantly lowers
6463
* the memory overhead for your application and improves performance.
65-
*
6664
* <h2>Asynchronous API</h2>
6765
* <p>
6866
* All overloads of {@link #runAsync(Query)} execute queries in async fashion and return {@link CompletionStage} of

driver/src/main/java/org/neo4j/driver/internal/async/connection/EventLoopGroupFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ private static class DriverThreadFactory extends DefaultThreadFactory {
114114
super(THREAD_NAME_PREFIX, THREAD_IS_DAEMON, THREAD_PRIORITY);
115115
}
116116

117+
@SuppressWarnings("InstantiatingAThreadWithDefaultRunMethod")
117118
@Override
118119
protected Thread newThread(Runnable r, String name) {
119120
return new DriverThread(threadGroup, r, name);

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
import org.neo4j.driver.internal.DatabaseName;
3838

3939
public class ClusterRoutingTable implements RoutingTable {
40-
private static final int MIN_ROUTERS = 1;
41-
4240
private final ReadWriteLock tableLock = new ReentrantReadWriteLock();
4341
private final DatabaseName databaseName;
4442
private final Clock clock;
@@ -66,9 +64,9 @@ public boolean isStaleFor(AccessMode mode) {
6664
return executeWithLock(
6765
tableLock.readLock(),
6866
() -> expirationTimestamp < clock.millis()
69-
|| routers.size() < MIN_ROUTERS
70-
|| mode == AccessMode.READ && readers.size() == 0
71-
|| mode == AccessMode.WRITE && writers.size() == 0);
67+
|| routers.isEmpty()
68+
|| mode == AccessMode.READ && readers.isEmpty()
69+
|| mode == AccessMode.WRITE && writers.isEmpty());
7270
}
7371

7472
@Override

driver/src/main/java/org/neo4j/driver/internal/handlers/pulln/BasicPullResponseHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected void state(State state) {
286286
this.state = state;
287287
}
288288

289-
enum State {
289+
protected enum State {
290290
READY_STATE {
291291
@Override
292292
void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {

driver/src/main/java/org/neo4j/driver/internal/messaging/common/CommonValuePacker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public final void pack(Value value) throws IOException {
9696

9797
@Override
9898
public final void pack(Map<String, Value> map) throws IOException {
99-
if (map == null || map.size() == 0) {
99+
if (map == null || map.isEmpty()) {
100100
packer.packMapHeader(0);
101101
return;
102102
}

driver/src/main/java/org/neo4j/driver/internal/messaging/request/HelloMessage.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,7 @@ private static Map<String, Value> buildMetadata(
9494
result.put(USER_AGENT_METADATA_KEY, value(userAgent));
9595
}
9696
if (boltAgent != null) {
97-
var boltAgentMap = new HashMap<String, String>();
98-
boltAgentMap.put(BOLT_AGENT_PRODUCT_KEY, boltAgent.product());
99-
if (boltAgent.platform() != null) {
100-
boltAgentMap.put(BOLT_AGENT_PLATFORM_KEY, boltAgent.platform());
101-
}
102-
if (boltAgent.language() != null) {
103-
boltAgentMap.put(BOLT_AGENT_LANGUAGE_KEY, boltAgent.language());
104-
}
105-
if (boltAgent.languageDetails() != null) {
106-
boltAgentMap.put(BOLT_AGENT_LANGUAGE_DETAIL_KEY, boltAgent.languageDetails());
107-
}
97+
var boltAgentMap = toMap(boltAgent);
10898
result.put(BOLT_AGENT_METADATA_KEY, value(boltAgentMap));
10999
}
110100
if (routingContext != null) {
@@ -116,4 +106,19 @@ private static Map<String, Value> buildMetadata(
116106
MessageWithMetadata.appendNotificationConfig(result, notificationConfig);
117107
return result;
118108
}
109+
110+
private static HashMap<String, String> toMap(BoltAgent boltAgent) {
111+
var boltAgentMap = new HashMap<String, String>();
112+
boltAgentMap.put(BOLT_AGENT_PRODUCT_KEY, boltAgent.product());
113+
if (boltAgent.platform() != null) {
114+
boltAgentMap.put(BOLT_AGENT_PLATFORM_KEY, boltAgent.platform());
115+
}
116+
if (boltAgent.language() != null) {
117+
boltAgentMap.put(BOLT_AGENT_LANGUAGE_KEY, boltAgent.language());
118+
}
119+
if (boltAgent.languageDetails() != null) {
120+
boltAgentMap.put(BOLT_AGENT_LANGUAGE_DETAIL_KEY, boltAgent.languageDetails());
121+
}
122+
return boltAgentMap;
123+
}
119124
}

0 commit comments

Comments
 (0)