From 27755723c23d475d915befe58f4c63966e3b02d1 Mon Sep 17 00:00:00 2001 From: Tom Bentley Date: Sat, 7 Mar 2020 07:47:32 +0000 Subject: [PATCH] KAFKA-9663: Update JavaDocs to indicate `null` return values in KafkaStreams (#8228) Reviewer: Matthias J. Sax --- .../java/org/apache/kafka/streams/KafkaStreams.java | 11 +++++++---- .../processor/internals/StreamsMetadataState.java | 9 +++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java b/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java index a48dd6a9646ae..45d6acb729175 100644 --- a/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java +++ b/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java @@ -1083,7 +1083,8 @@ public Collection allMetadataForStore(final String storeName) { * @param keySerializer serializer for the key * @param key type * @return {@link StreamsMetadata} for the {@code KafkaStreams} instance with the provided {@code storeName} and - * {@code key} of this application or {@link StreamsMetadata#NOT_AVAILABLE} if Kafka Streams is (re-)initializing + * {@code key} of this application or {@link StreamsMetadata#NOT_AVAILABLE} if Kafka Streams is (re-)initializing, + * or {@code null} if no matching metadata could be found. * @deprecated Since 2.5. Use {@link #queryMetadataForKey(String, Object, Serializer)} instead. */ @Deprecated @@ -1116,7 +1117,8 @@ public StreamsMetadata metadataForKey(final String storeName, * @param partitioner the partitioner to be use to locate the host for the key * @param key type * @return {@link StreamsMetadata} for the {@code KafkaStreams} instance with the provided {@code storeName} and - * {@code key} of this application or {@link StreamsMetadata#NOT_AVAILABLE} if Kafka Streams is (re-)initializing + * {@code key} of this application or {@link StreamsMetadata#NOT_AVAILABLE} if Kafka Streams is (re-)initializing, + * or {@code null} if no matching metadata could be found. * @deprecated Since 2.5. Use {@link #queryMetadataForKey(String, Object, StreamPartitioner)} instead. */ @Deprecated @@ -1134,7 +1136,8 @@ public StreamsMetadata metadataForKey(final String storeName, * @param key the key to find metadata for * @param keySerializer serializer for the key * @param key type - * Returns {@link KeyQueryMetadata} containing all metadata about hosting the given key for the given store. + * Returns {@link KeyQueryMetadata} containing all metadata about hosting the given key for the given store, + * or {@code null} if no matching metadata could be found. */ public KeyQueryMetadata queryMetadataForKey(final String storeName, final K key, @@ -1151,7 +1154,7 @@ public KeyQueryMetadata queryMetadataForKey(final String storeName, * @param partitioner the partitioner to be use to locate the host for the key * @param key type * Returns {@link KeyQueryMetadata} containing all metadata about hosting the given key for the given store, using the - * the supplied partitioner + * the supplied partitioner, or {@code null} if no matching metadata could be found. */ public KeyQueryMetadata queryMetadataForKey(final String storeName, final K key, diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsMetadataState.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsMetadataState.java index 154d795362a50..a84f9e7f856fb 100644 --- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsMetadataState.java +++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsMetadataState.java @@ -136,7 +136,7 @@ public synchronized Collection getAllMetadataForStore(final Str * @param keySerializer Serializer for the key * @param key type * @return The {@link StreamsMetadata} for the storeName and key or {@link StreamsMetadata#NOT_AVAILABLE} - * if streams is (re-)initializing + * if streams is (re-)initializing, or {@code null} if no matching metadata could be found. * @deprecated Use {@link #getKeyQueryMetadataForKey(String, Object, Serializer)} instead. */ @Deprecated @@ -184,7 +184,8 @@ public synchronized StreamsMetadata getMetadataWithKey(final String storeNam * @param keySerializer Serializer for the key * @param key type * @return The {@link KeyQueryMetadata} for the storeName and key or {@link KeyQueryMetadata#NOT_AVAILABLE} - * if streams is (re-)initializing or null if the corresponding topic cannot be found + * if streams is (re-)initializing or {@code null} if the corresponding topic cannot be found, + * or null if no matching metadata could be found. */ public synchronized KeyQueryMetadata getKeyQueryMetadataForKey(final String storeName, final K key, @@ -206,7 +207,7 @@ public synchronized KeyQueryMetadata getKeyQueryMetadataForKey(final String * @param partitioner partitioner to use to find correct partition for key * @param key type * @return The {@link KeyQueryMetadata} for the storeName and key or {@link KeyQueryMetadata#NOT_AVAILABLE} - * if streams is (re-)initializing + * if streams is (re-)initializing, or {@code null} if no matching metadata could be found. */ public synchronized KeyQueryMetadata getKeyQueryMetadataForKey(final String storeName, final K key, @@ -246,7 +247,7 @@ public synchronized KeyQueryMetadata getKeyQueryMetadataForKey(final String * @param partitioner partitioner to use to find correct partition for key * @param key type * @return The {@link StreamsMetadata} for the storeName and key or {@link StreamsMetadata#NOT_AVAILABLE} - * if streams is (re-)initializing + * if streams is (re-)initializing, or {@code null} if no matching metadata could be found. * @deprecated Use {@link #getKeyQueryMetadataForKey(String, Object, StreamPartitioner)} instead. */ @Deprecated