Skip to content

Commit 9e8d6c3

Browse files
fix: Make driver more resilient agains already existing attribute keys for Netty channels. (#1625)
1 parent 9e6e559 commit 9e8d6c3

File tree

1 file changed

+14
-14
lines changed
  • bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/async/connection

1 file changed

+14
-14
lines changed

bolt-api-netty/src/main/java/org/neo4j/driver/internal/bolt/basicimpl/impl/async/connection/ChannelAttributes.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
package org.neo4j.driver.internal.bolt.basicimpl.impl.async.connection;
1818

19-
import static io.netty.util.AttributeKey.newInstance;
19+
import static io.netty.util.AttributeKey.valueOf;
2020

2121
import io.netty.channel.Channel;
2222
import io.netty.util.AttributeKey;
@@ -30,23 +30,23 @@
3030
import org.neo4j.driver.internal.bolt.basicimpl.impl.messaging.BoltPatchesListener;
3131

3232
public final class ChannelAttributes {
33-
private static final AttributeKey<String> CONNECTION_ID = newInstance("connectionId");
34-
private static final AttributeKey<BoltProtocolVersion> PROTOCOL_VERSION = newInstance("protocolVersion");
35-
private static final AttributeKey<String> SERVER_AGENT = newInstance("serverAgent");
36-
private static final AttributeKey<BoltServerAddress> ADDRESS = newInstance("serverAddress");
37-
private static final AttributeKey<Long> CREATION_TIMESTAMP = newInstance("creationTimestamp");
38-
private static final AttributeKey<Long> LAST_USED_TIMESTAMP = newInstance("lastUsedTimestamp");
39-
private static final AttributeKey<InboundMessageDispatcher> MESSAGE_DISPATCHER = newInstance("messageDispatcher");
40-
private static final AttributeKey<String> TERMINATION_REASON = newInstance("terminationReason");
33+
private static final AttributeKey<String> CONNECTION_ID = valueOf("connectionId");
34+
private static final AttributeKey<BoltProtocolVersion> PROTOCOL_VERSION = valueOf("protocolVersion");
35+
private static final AttributeKey<String> SERVER_AGENT = valueOf("serverAgent");
36+
private static final AttributeKey<BoltServerAddress> ADDRESS = valueOf("serverAddress");
37+
private static final AttributeKey<Long> CREATION_TIMESTAMP = valueOf("creationTimestamp");
38+
private static final AttributeKey<Long> LAST_USED_TIMESTAMP = valueOf("lastUsedTimestamp");
39+
private static final AttributeKey<InboundMessageDispatcher> MESSAGE_DISPATCHER = valueOf("messageDispatcher");
40+
private static final AttributeKey<String> TERMINATION_REASON = valueOf("terminationReason");
4141
private static final AttributeKey<AuthorizationStateListener> AUTHORIZATION_STATE_LISTENER =
42-
newInstance("authorizationStateListener");
42+
valueOf("authorizationStateListener");
4343
private static final AttributeKey<Set<BoltPatchesListener>> BOLT_PATCHES_LISTENERS =
44-
newInstance("boltPatchesListeners");
44+
valueOf("boltPatchesListeners");
4545

4646
// configuration hints provided by the server
47-
private static final AttributeKey<Long> CONNECTION_READ_TIMEOUT = newInstance("connectionReadTimeout");
48-
private static final AttributeKey<Boolean> TELEMETRY_ENABLED = newInstance("telemetryEnabled");
49-
private static final AttributeKey<Boolean> SSR_ENABLED = newInstance("ssr.enabled");
47+
private static final AttributeKey<Long> CONNECTION_READ_TIMEOUT = valueOf("connectionReadTimeout");
48+
private static final AttributeKey<Boolean> TELEMETRY_ENABLED = valueOf("telemetryEnabled");
49+
private static final AttributeKey<Boolean> SSR_ENABLED = valueOf("ssr.enabled");
5050

5151
private ChannelAttributes() {}
5252

0 commit comments

Comments
 (0)