Skip to content

Commit da21b53

Browse files
authored
MINOR: Java version and TLS documentation improvements (#18822)
Most of the changes are obvious clean-ups/fixes. A couple of noteworthy items: 1. Support for non LTS versions is clarified (we were incorrectly stating full support for Java 23). 2. TLS version negotiation details are clarified. Reviewers: Matthias J. Sax <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent 4e36368 commit da21b53

File tree

8 files changed

+25
-29
lines changed

8 files changed

+25
-29
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ project(':group-coordinator') {
15271527

15281528

15291529
project(':test-common:test-common-internal-api') {
1530-
// Interfaces, config classes, and other test APIs. Java 17 only
1530+
// Interfaces, config classes, and other test APIs. Java 17 is the minimum Java version.
15311531
base {
15321532
archivesName = "kafka-test-common-internal-api"
15331533
}
@@ -1554,7 +1554,7 @@ project(':test-common:test-common-internal-api') {
15541554
}
15551555

15561556
project(':test-common:test-common-util') {
1557-
// Runtime-only JUnit extensions for entire project. Java 11 only
1557+
// Runtime-only JUnit extensions for entire project. Java 11 is the minimum Java version required.
15581558
base {
15591559
archivesName = "kafka-test-common-util"
15601560
}
@@ -1577,7 +1577,7 @@ project(':test-common:test-common-util') {
15771577
}
15781578

15791579
project(':test-common:test-common-runtime') {
1580-
// Runtime-only JUnit extensions for integration tests. Java 17 only
1580+
// Runtime-only JUnit extensions for integration tests. Java 17 is the minimum Java version.
15811581
base {
15821582
archivesName = "kafka-test-common-runtime"
15831583
}

clients/src/main/java/org/apache/kafka/common/config/SslConfigs.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ public class SslConfigs {
2929
*/
3030

3131
public static final String SSL_PROTOCOL_CONFIG = "ssl.protocol";
32-
public static final String SSL_PROTOCOL_DOC = "The SSL protocol used to generate the SSLContext. "
33-
+ "The default is 'TLSv1.3' when running with Java 11 or newer, 'TLSv1.2' otherwise. "
34-
+ "This value should be fine for most use cases. "
35-
+ "Allowed values in recent JVMs are 'TLSv1.2' and 'TLSv1.3'. 'TLS', 'TLSv1.1', 'SSL', 'SSLv2' and 'SSLv3' "
36-
+ "may be supported in older JVMs, but their usage is discouraged due to known security vulnerabilities. "
37-
+ "With the default value for this config and 'ssl.enabled.protocols', clients will downgrade to 'TLSv1.2' if "
38-
+ "the server does not support 'TLSv1.3'. If this config is set to 'TLSv1.2', clients will not use 'TLSv1.3' even "
39-
+ "if it is one of the values in ssl.enabled.protocols and the server only supports 'TLSv1.3'.";
32+
public static final String SSL_PROTOCOL_DOC = "The SSL protocol used to generate the SSLContext. The default is 'TLSv1.3', "
33+
+ "which should be fine for most use cases. A typical alternative to the default is 'TLSv1.2'. Allowed values for "
34+
+ "this config are dependent on the JVM. "
35+
+ "Clients using the defaults for this config and 'ssl.enabled.protocols' will downgrade to 'TLSv1.2' if "
36+
+ "the server does not support 'TLSv1.3'. If this config is set to 'TLSv1.2', however, clients will not use 'TLSv1.3' even "
37+
+ "if it is one of the values in `ssl.enabled.protocols` and the server only supports 'TLSv1.3'.";
4038

4139
public static final String DEFAULT_SSL_PROTOCOL = "TLSv1.3";
4240

@@ -49,10 +47,9 @@ public class SslConfigs {
4947

5048
public static final String SSL_ENABLED_PROTOCOLS_CONFIG = "ssl.enabled.protocols";
5149
public static final String SSL_ENABLED_PROTOCOLS_DOC = "The list of protocols enabled for SSL connections. "
52-
+ "The default is 'TLSv1.2,TLSv1.3' when running with Java 11 or newer, 'TLSv1.2' otherwise. With the "
53-
+ "default value for Java 11, clients and servers will prefer TLSv1.3 if both support it and fallback "
54-
+ "to TLSv1.2 otherwise (assuming both support at least TLSv1.2). This default should be fine for most "
55-
+ "cases. Also see the config documentation for `ssl.protocol`.";
50+
+ "The default is 'TLSv1.2,TLSv1.3'. This means that clients and servers will prefer TLSv1.3 if both support it "
51+
+ "and fallback to TLSv1.2 otherwise (assuming both support at least TLSv1.2). This default should be fine for most use "
52+
+ "cases. Also see the config documentation for `ssl.protocol` to understand how it can impact the TLS version negotiation behavior.";
5653
public static final String DEFAULT_SSL_ENABLED_PROTOCOLS = "TLSv1.2,TLSv1.3";
5754

5855
public static final String SSL_KEYSTORE_TYPE_CONFIG = "ssl.keystore.type";

docs/ops.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,14 +1217,14 @@ <h4 class="anchor-heading"><a id="multitenancy-more" class="anchor-link"></a><a
12171217

12181218
<h3 class="anchor-heading"><a id="java" class="anchor-link"></a><a href="#java">6.5 Java Version</a></h3>
12191219

1220-
Java 11, Java 17, Java 21 and Java 23 are supported.
1221-
<p>
1222-
Note that Java 11 support for the broker and tools has been deprecated since Apache Kafka 3.7. Both will be removed in Apache Kafka 4.0.
1223-
<p>
1224-
Java 11 and later versions perform significantly better if TLS is enabled, so they are highly recommended (they also include a number of other
1225-
performance improvements: G1GC, CRC32C, Compact Strings, Thread-Local Handshakes and more).
1220+
Java 17 and Java 21 are fully supported while Java 11 is supported for a subset of modules (clients, streams and related).
1221+
Support for versions newer than the most recent LTS version are best-effort and the project typically only tests with the
1222+
most recent non LTS version.
1223+
12261224
<p>
1227-
From a security perspective, we recommend the latest released patch version as older freely available versions have disclosed security vulnerabilities.
1225+
We generally recommend running Apache Kafka with the most recent LTS release (Java 21 at the time of writing) for performance,
1226+
efficiency and support reasons. From a security perspective, we recommend the latest released patch version as older versions
1227+
typically have disclosed security vulnerabilities.
12281228
<p>
12291229
Typical arguments for running Kafka with OpenJDK-based Java implementations (including Oracle JDK) are:
12301230

docs/streams/developer-guide/interactive-queries.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
interface to get access to the underlying instances of your store.
270270
<code class="docutils literal"><span class="pre">StateStoreProvider#stores(String</span> <span class="pre">storeName,</span> <span class="pre">QueryableStoreType&lt;T&gt;</span> <span class="pre">queryableStoreType)</span></code> returns a <code class="docutils literal"><span class="pre">List</span></code> of state
271271
stores with the given storeName and of the type as defined by <code class="docutils literal"><span class="pre">queryableStoreType</span></code>.</p>
272-
<p>Here is an example implementation of the wrapper follows (Java 8+):</p>
272+
<p>Here is an example implementation of the wrapper:</p>
273273
<pre class="line-numbers"><code class="language-java">// We strongly recommended implementing a read-only interface
274274
// to restrict usage of the store to safe read operations!
275275
public class MyCustomStoreTypeWrapper&lt;K,V&gt; implements MyReadableCustomStore&lt;K,V&gt; {

docs/streams/developer-guide/write-streams.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ <h2>Using Kafka Streams within your application code<a class="headerlink" href="
151151
For more information, see <a class="reference internal" href="../architecture.html#streams_architecture_tasks"><span class="std std-ref">Stream Partitions and Tasks</span></a> and <a class="reference internal" href="../architecture.html#streams_architecture_threads"><span class="std std-ref">Threading Model</span></a>.</p>
152152
<p>To catch any unexpected exceptions, you can set an <code class="docutils literal"><span class="pre">java.lang.Thread.UncaughtExceptionHandler</span></code> before you start the
153153
application. This handler is called whenever a stream thread is terminated by an unexpected exception:</p>
154-
<pre class="line-numbers"><code class="language-java">// Java 8+, using lambda expressions
155-
streams.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -&gt; {
154+
<pre class="line-numbers"><code class="language-java">streams.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -&gt; {
156155
// here you should examine the throwable/exception and perform an appropriate action!
157156
});
158157
</code></pre>
@@ -161,7 +160,7 @@ <h2>Using Kafka Streams within your application code<a class="headerlink" href="
161160
streams.close();</code></pre>
162161
<p>To allow your application to gracefully shutdown in response to SIGTERM, it is recommended that you add a shutdown hook
163162
and call <code class="docutils literal"><span class="pre">KafkaStreams#close</span></code>.</p>
164-
<p class="first">Here is a shutdown hook example in Java 8+:</p>
163+
<p class="first">Here is a shutdown hook example in Java:</p>
165164
<pre class="line-numbers"><code class="language-java">// Add shutdown hook to stop the Kafka Streams threads.
166165
// You can optionally provide a timeout to `close`.
167166
Runtime.getRuntime().addShutdownHook(new Thread(streams::close));</code></pre>

docs/streams/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ <h3 style="margin-top: 5.3rem;">Hello Kafka Streams</h3>
193193

194194
<div class="code-example">
195195
<div class="btn-group">
196-
<a class="selected b-java-8" data-section="java-8">Java 8+</a>
196+
<a class="selected b-java-8" data-section="java-8">Java</a>
197197
<a class="b-scala" data-section="scala">Scala</a>
198198
</div>
199199

docs/streams/quickstart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h1>Run Kafka Streams Demo Application</h1>
4545
</p>
4646
<p>
4747
This quickstart example will demonstrate how to run a streaming application coded in this library. Here is the gist
48-
of the <code><a href="https://github.com/apache/kafka/blob/{{dotVersion}}/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountDemo.java">WordCountDemo</a></code> example code (converted to use Java 8 lambda expressions for easy reading).
48+
of the <code><a href="https://github.com/apache/kafka/blob/{{dotVersion}}/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountDemo.java">WordCountDemo</a></code> example code.
4949
</p>
5050
<pre class="line-numbers"><code class="language-java">// Serializers/deserializers (serde) for String and Long types
5151
final Serde&lt;String&gt; stringSerde = Serdes.String();

docs/streams/tutorial.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h4 class="anchor-heading"><a id="tutorial_maven_setup" class="anchor-link"></a>
7070

7171
<p>
7272
The <code>pom.xml</code> file included in the project already has the Streams dependency defined.
73-
Note, that the generated <code>pom.xml</code> targets Java 8, and does not work with higher Java versions.
73+
Note, that the generated <code>pom.xml</code> targets Java 11.
7474
</p>
7575

7676
<p>

0 commit comments

Comments
 (0)