Skip to content

Commit aee893b

Browse files
authored
Refactoring (#1467)
1 parent 20e7ce5 commit aee893b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+106
-97
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* When running a transaction, a write transaction requires a server that supports writes.
2424
* A read transaction, on the other hand, requires a server that supports read operations.
2525
* This classification is key for routing driver to route transactions to a cluster correctly.
26-
*
26+
* <p>
2727
* While any {@link AccessMode} will be ignored while running transactions via a driver towards a single server.
2828
* As the single server serves both read and write operations at the same time.
2929
*/

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
/**
2626
* Causal chaining is carried out by passing bookmarks between transactions.
27-
*
27+
* <p>
2828
* When starting a session with initial bookmarks, the first transaction will be ensured to run at least after
2929
* the database is as up-to-date as the latest transaction referenced by the supplied bookmarks.
30-
*
30+
* <p>
3131
* Within a session, bookmark propagation is carried out automatically.
3232
* Thus all transactions in a session (both managed and unmanaged) are guaranteed to be carried out one after another.
33-
*
33+
* <p>
3434
* To opt out of this mechanism for unrelated units of work, applications can use multiple sessions.
3535
*/
3636
public interface Bookmark {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static BookmarkManagerConfigBuilder builder() {
5151
/**
5252
* Returns the map of bookmarks used to initialise the bookmark manager.
5353
*
54-
* @return the map of bookmarks
54+
* @return the set of bookmarks
5555
*/
5656
public Set<Bookmark> initialBookmarks() {
5757
return initialBookmarks;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public Query withParameters(Map<String, Object> newParameters) {
120120
/**
121121
* Create a new query with new parameters derived by updating this'
122122
* query's parameters using the given updates.
123-
*
123+
* <p>
124124
* Every update key that points to a null value will be removed from
125125
* the new query's parameters. All other entries will just replace
126126
* any existing parameter in the new query.

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929

3030
/**
3131
* The result of running a Cypher query, conceptually a stream of {@link Record records}.
32-
*
32+
* <p>
3333
* The standard way of navigating through the result returned by the database is to
3434
* {@link #next() iterate} over it.
35-
*
35+
* <p>
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()}.
@@ -42,11 +42,11 @@
4242
* In order to handle very large results, and to minimize memory overhead and maximize
4343
* performance, results are retrieved lazily. Please see {@link QueryRunner} for
4444
* important details on the effects of this.
45-
*
45+
* <p>
4646
* The short version is that, if you want a hard guarantee that the underlying query
4747
* has completed, you need to either call {@link Resource#close()} on the {@link Transaction}
4848
* or {@link Session} that created this result, or you need to use the result.
49-
*
49+
* <p>
5050
* Calling any method on this interface will guarantee that any write operation has completed on
5151
* the remote database.
5252
*
@@ -79,7 +79,7 @@ public interface Result extends Iterator<Record> {
7979
/**
8080
* Return the first record in the result, failing if there is not exactly
8181
* one record left in the stream
82-
*
82+
* <p>
8383
* Calling this method always exhausts the result, even when {@link NoSuchRecordException} is thrown.
8484
*
8585
* @return the first and only record in the stream
@@ -108,12 +108,12 @@ public interface Result extends Iterator<Record> {
108108
* Retrieve and store the entire result stream.
109109
* This can be used if you want to iterate over the stream multiple times or to store the
110110
* whole result for later use.
111-
*
111+
* <p>
112112
* Note that this method can only be used if you know that the query that
113113
* yielded this result returns a finite stream. Some queries can yield
114114
* infinite results, in which case calling this method will lead to running
115115
* out of memory.
116-
*
116+
* <p>
117117
* Calling this method exhausts the result.
118118
*
119119
* @return list of all remaining immutable records
@@ -124,12 +124,12 @@ public interface Result extends Iterator<Record> {
124124
* Retrieve and store a projection of the entire result.
125125
* This can be used if you want to iterate over the stream multiple times or to store the
126126
* whole result for later use.
127-
*
127+
* <p>
128128
* Note that this method can only be used if you know that the query that
129129
* yielded this result returns a finite stream. Some queries can yield
130130
* infinite results, in which case calling this method will lead to running
131131
* out of memory.
132-
*
132+
* <p>
133133
* Calling this method exhausts the result.
134134
*
135135
* @param mapFunction a function to map from Record to T. See {@link Records} for some predefined functions.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ public Builder withDatabase(String database) {
332332
* Specify how many records to fetch in each batch for this session.
333333
* This config will overrides the default value set on {@link Config#fetchSize()}.
334334
* This config is only valid when the driver is used with servers that support Bolt V4 (Server version 4.0 and later).
335-
*
335+
* <p>
336336
* Bolt V4 enables pulling records in batches to allow client to take control of data population and apply back pressure to server.
337337
* This config specifies the default fetch size for all query runs using {@link Session} and {@link AsyncSession}.
338338
* By default, the value is set to {@code 1000}.
339339
* Use {@code -1} to disables back pressure and config client to pull all records at once after each run.
340-
*
340+
* <p>
341341
* This config only applies to run result obtained via {@link Session} and {@link AsyncSession}.
342342
* As with {@link RxSession}, the batch size is provided via {@link Subscription#request(long)} instead.
343343
* @param size the default record fetch size when pulling records in batches using Bolt V4.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public interface SimpleQueryRunner {
9595
*
9696
* Map<String, Object> parameters = new HashMap<String, Object>();
9797
* parameters.put("myNameParam", "Bob");
98-
*
98+
* <p>
9999
* Result result = session.run( "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
100100
* parameters );
101101
* }

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
/**
4848
* A unit of data that adheres to the Neo4j type system.
49-
*
49+
* <p>
5050
* This interface describes a number of <code>isType</code> methods along with
5151
* <code>typeValue</code> methods. The first set of these correlate with types from
5252
* the Neo4j Type System and are used to determine which Neo4j type is represented.
@@ -59,7 +59,7 @@
5959
* Because Neo4j often handles dynamic structures, this interface is designed to help
6060
* you handle such structures in Java. Specifically, {@link Value} lets you navigate arbitrary tree
6161
* structures without having to resort to type casting.
62-
*
62+
* <p>
6363
* Given a tree structure like:
6464
*
6565
* <pre>
@@ -74,15 +74,13 @@
7474
* </pre>
7575
*
7676
* You can retrieve the name of the second user, John, like so:
77-
*
7877
* <pre class="docTest:ValueDocIT#classDocTreeExample">
7978
* {@code
8079
* String username = value.get("users").get(1).get("name").asString();
8180
* }
8281
* </pre>
8382
*
8483
* You can also easily iterate over the users:
85-
*
8684
* <pre class="docTest:ValueDocIT#classDocIterationExample">
8785
* {@code
8886
* List<String> names = new LinkedList<>();
@@ -497,7 +495,7 @@ public interface Value extends MapAccessor, MapAccessorWithDefaultValue {
497495
/**
498496
* Return as a map of string keys and values converted using
499497
* {@link Value#asObject()}.
500-
*
498+
* <p>
501499
* This is equivalent to calling {@link #asMap(Function, Map)} with {@link Values#ofObject()}.
502500
*
503501
* @param defaultValue default to this value if the value is a {@link NullValue}

driver/src/main/java/org/neo4j/driver/exceptions/NoSuchRecordException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* Thrown whenever a client expected to read a record that was not available (i.e. because it wasn't returned by the server).
26-
*
26+
* <p>
2727
* This usually indicates an expectation mismatch between client code and database application logic.
2828
*
2929
* @since 1.0

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,9 @@ private CompletionStage<Channel> auth(Channel channel, AuthToken overrideAuthTok
190190
.enqueue(new LogonResponseHandler(logonFuture, channel, clock));
191191
authContext.initiateAuth(latestAuthToken);
192192
channel.write(new LogonMessage(((InternalAuthToken) latestAuthToken).toMap()));
193-
// do not await for re-login
194-
result = CompletableFuture.completedStage(channel);
195-
} else {
196-
result = CompletableFuture.completedStage(channel);
197193
}
194+
// do not await for re-login
195+
result = CompletableFuture.completedStage(channel);
198196
} else {
199197
var logonFuture = new CompletableFuture<Void>();
200198
messageDispatcher(channel).enqueue(new LogonResponseHandler(logonFuture, channel, clock));

0 commit comments

Comments
 (0)