Skip to content

Commit cab530d

Browse files
authored
[JAVA] Remove deprecated Stream-related types (#513)
* SteamFactory deprecations
1 parent bc4d891 commit cab530d

File tree

4 files changed

+55
-20
lines changed

4 files changed

+55
-20
lines changed

source/fundamentals/connection/mongoclientsettings.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ connection behavior:
142142
- Sets the :ref:`server API <stable-api-java>` to use when sending
143143
commands to the server.
144144

145-
* - ``streamFactoryFactory()``
146-
- Sets the factory to use to create a ``StreamFactory``.
145+
* - ``transportSettings()``
146+
- Sets `TransportSettings <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/TransportSettings.html>`__.
147147

148148
* - ``uuidRepresentation()``
149149
- Sets the UUID representation to use when encoding instances of UUID

source/fundamentals/connection/socks.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ SOCKS5 Proxy Settings
2929

3030
The proxy settings specify the SOCKS5 proxy server address and your
3131
authentication credentials. You can specify your settings in an instance of
32-
``MongoClientSettings`` or in your connection string.
32+
:ref:`MongoClientSettings <mongoclientsettings>` or in your :ref:`connection
33+
string <connection-uri>`.
3334

3435
.. important::
35-
36-
The driver ignores the proxy settings if you specify a custom
37-
``StreamFactoryFactory``, which by default creates instances of
38-
``SocketStreamFactory``.
36+
37+
The driver ignores the proxy settings if either of the following are true:
38+
39+
- A Unix domain socket handles the communication.
40+
For more information, see the `UnixServerAddress documentation <{+api+}/apidocs/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__.
41+
- ``TransportSettings`` are configured.
42+
For more information, see the `TransportSettings documentation <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/TransportSettings.html>`__.
3943

4044
The following table describes the SOCKS5 client options:
4145

source/fundamentals/connection/tls.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ provided by Netty.
270270
import com.mongodb.MongoClientSettings;
271271
import com.mongodb.client.MongoClients;
272272
import com.mongodb.client.MongoClient;
273-
import com.mongodb.connection.netty.NettyStreamFactoryFactory;
274273
import io.netty.handler.ssl.SslContext;
275274
import io.netty.handler.ssl.SslContextBuilder;
276275
import io.netty.handler.ssl.SslProvider;
@@ -279,25 +278,35 @@ provided by Netty.
279278

280279
The driver tests with Netty version ``{+nettyVersion+}``
281280

282-
To instruct the driver to use `io.netty.handler.ssl.SslContext <https://netty.io/4.1/api/io/netty/handler/ssl/SslContext.html>`__,
283-
use the `NettyStreamFactoryFactory.Builder.sslContext <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/netty/NettyStreamFactoryFactory.Builder.html#sslContext(io.netty.handler.ssl.SslContext)>`__
284-
method. See the method documentation for details about the different `io.netty.handler.ssl.SslProvider <https://netty.io/4.1/api/io/netty/handler/ssl/SslProvider.html>`__
285-
variants the driver supports and the implications of using them.
281+
To instruct the driver to use
282+
`io.netty.handler.ssl.SslContext <https://netty.io/4.1/api/io/netty/handler/ssl/SslContext.html>`__,
283+
configure
284+
`NettyTransportSettings <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/NettyTransportSettings.html>`__
285+
when you define your `MongoClientSettings <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.html>`__.
286+
Use `MongoClientSettings.Builder.transportSettings
287+
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#transportSettings(com.mongodb.connection.TransportSettings)>`__
288+
and `NettyTransportSettings.Builder.sslContext
289+
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/NettyTransportSettings.Builder.html#sslContext(io.netty.handler.ssl.SslContext)>`__
290+
to build your settings:
286291

287292
.. code-block:: java
293+
:emphasize-lines: 3-8
288294
:copyable: true
289295

290296
SslContext sslContext = SslContextBuilder.forClient()
291297
.sslProvider(SslProvider.OPENSSL)
292298
.build();
293299
MongoClientSettings settings = MongoClientSettings.builder()
294300
.applyToSslSettings(builder -> builder.enabled(true))
295-
.streamFactoryFactory(NettyStreamFactoryFactory.builder()
296-
.sslContext(sslContext)
297-
.build())
301+
.transportSettings(TransportSettings.nettyBuilder()
302+
.sslContext(sslContext)
303+
.build())
298304
.build();
299305
MongoClient client = MongoClients.create(settings);
300306

307+
For more details about the ``io.netty.handler.ssl.SslProvider``, see the `Netty
308+
documentation
309+
<https://netty.io/4.1/api/io/netty/handler/ssl/SslProvider.html>`__
301310

302311
Online Certificate Status Protocol (OCSP)
303312
-----------------------------------------

source/upgrade.txt

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ This driver version introduces the following breaking changes:
8080
``long`` instead of type ``int``. Because this change breaks both binary and source
8181
compatibility, update any source code that uses these methods and rebuild your binary.
8282

83-
- The following record annotations from the
84-
``org.bson.codecs.record.annotations`` package are replaced with
83+
- Replaces the following record annotations from the
84+
``org.bson.codecs.record.annotations`` package with
8585
annotations of the same name from the ``org.bson.codecs.pojo.annotations`` package:
8686

8787
- ``BsonId``
@@ -152,7 +152,7 @@ This driver version introduces the following breaking changes:
152152
``BsonDecimal128.isNumber()`` now returns ``true``, and
153153
``BsonDecimal128.asNumber()`` returns the equivalent ``BsonNumber``.
154154

155-
- This driver version removes the `ServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/ServerAddress.html>`__
155+
- Removes the `ServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/ServerAddress.html>`__
156156
methods ``getSocketAddress()`` and ``getSocketAddresses()``.
157157

158158
Instead of ``getSocketAddress()``, use the ``getByName()`` instance
@@ -161,7 +161,7 @@ This driver version introduces the following breaking changes:
161161
Instead of ``getSocketAddresses()``, use the ``getAllByName()`` instance
162162
method of ``java.net.InetAddress``.
163163

164-
- This driver version removes the `UnixServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__
164+
- Removes the `UnixServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__
165165
methods ``getSocketAddress()`` and ``getUnixSocketAddress()``.
166166

167167
Instead of ``getUnixSocketAddress()``, construct an instance of
@@ -283,11 +283,33 @@ This driver version introduces the following breaking changes:
283283

284284
.. _java-breaking-changes-v5.0-list-collections:
285285

286-
- This driver version adds support for a new ``authorizedCollection`` option of
286+
- Adds support for a new ``authorizedCollection`` option of
287287
the ``listCollections`` command. This introduces a breaking binary
288288
change in the ``MongoDatabase.listCollectionNames()`` methods, meaning any
289289
code using these methods must be recompiled. This change does not require any
290290
changes to source code.
291+
292+
- Removes the following methods and types related to the
293+
`StreamFactory
294+
<https://mongodb.github.io/mongo-java-driver/4.11/apidocs/mongodb-driver-core/com/mongodb/connection/StreamFactory.html>`__
295+
296+
- Removes the following methods and types related to the
297+
`Stream
298+
<https://mongodb.github.io/mongo-java-driver/4.11/apidocs/mongodb-driver-core/com/mongodb/connection/Stream.html>`__
299+
interface:
300+
301+
- ``streamFactoryFactory()`` method from ``MongoClientSettings.Builder``
302+
- ``getStreamFactoryFactory()`` method from ``MongoClientSettings``
303+
- ``NettyStreamFactoryFactory`` class
304+
- ``NettyStreamFactory`` class
305+
- ``AsynchronousSocketChannelStreamFactory`` class
306+
- ``AsynchronousSocketChannelStreamFactoryFactory`` class
307+
- ``BufferProvider`` interface
308+
- ``SocketStreamFactory`` class
309+
- ``Stream`` interface
310+
- ``StreamFactory`` interface
311+
- ``StreamFactoryFactory`` interface
312+
- ``TlsChannelStreamFactoryFactory`` class
291313

292314
.. _java-breaking-changes-v4.8:
293315

0 commit comments

Comments
 (0)