File tree Expand file tree Collapse file tree
src/main/java/com/datastax/oss/driver Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55### 4.3.0 (in progress)
66
7+ - [ documentation] JAVA-2505: Annotate Node.getHostId() as nullable
78- [ improvement] JAVA-1708: Support DSE "everywhere" replication strategy
89- [ improvement] JAVA-2471: Consider DSE version when parsing the schema
910- [ improvement] JAVA-2444: Add method setRoutingKey(ByteBuffer...) to StatementBuilder
Original file line number Diff line number Diff line change 48164816 "old": "field com\\.datastax\\.oss\\.driver\\.api\\.core\\.Version.V.*",
48174817 "annotation": "@edu.umd.cs.findbugs.annotations.NonNull",
48184818 "justification": "Marking constants as non-null doesn't break existing code"
4819+ },
4820+ {
4821+ "code": "java.annotation.removed",
4822+ "old": "method java.util.UUID com.datastax.oss.driver.api.core.metadata.Node::getHostId()",
4823+ "new": "method java.util.UUID com.datastax.oss.driver.api.core.metadata.Node::getHostId()",
4824+ "annotation": "@edu.umd.cs.findbugs.annotations.NonNull",
4825+ "justification": "JAVA-2505: Annotate Node.getHostId() as nullable"
4826+ },
4827+ {
4828+ "code": "java.annotation.added",
4829+ "old": "method java.util.UUID com.datastax.oss.driver.api.core.metadata.Node::getHostId()",
4830+ "new": "method java.util.UUID com.datastax.oss.driver.api.core.metadata.Node::getHostId()",
4831+ "annotation": "@edu.umd.cs.findbugs.annotations.Nullable",
4832+ "justification": "JAVA-2505: Annotate Node.getHostId() as nullable"
48194833 }
48204834 ]
48214835 }
Original file line number Diff line number Diff line change @@ -184,9 +184,26 @@ public interface Node {
184184 * The host ID that is assigned to this node by Cassandra. This value can be used to uniquely
185185 * identify a node even when the underling IP address changes.
186186 *
187- * <p>This information is always present.
187+ * <p>This information is always present once the session has initialized. However, there is a
188+ * narrow corner case where a driver client can observe a null value: if a {@link
189+ * NodeStateListener} is registered, the <b>very first</b> {@code onUp} call will reference a node
190+ * that has a null id (that node is the initial contact point, and the driver hasn't read host ids
191+ * from {@code system.local} and {@code system.peers} yet). Beyond that point — including
192+ * any other {@code onUp} call — the host id will always be present.
193+ *
194+ * <pre>
195+ * CqlSession session = CqlSession.builder()
196+ * .withNodeStateListener(
197+ * new NodeStateListenerBase() {
198+ * @Override
199+ * public void onUp(@NonNull Node node) {
200+ * // node.getHostId() == null for the first invocation only
201+ * }
202+ * })
203+ * .build();
204+ * </pre>
188205 */
189- @ NonNull
206+ @ Nullable
190207 UUID getHostId ();
191208
192209 /**
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public Version getCassandraVersion() {
129129 return cassandraVersion ;
130130 }
131131
132- @ NonNull
132+ @ Nullable
133133 @ Override
134134 public UUID getHostId () {
135135 return hostId ;
You can’t perform that action at this time.
0 commit comments