Skip to content

[Java] Breaking change for timeout parameters for SocketSettings builder methods #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
23 changes: 19 additions & 4 deletions source/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ the version after v4.0 including any listed under v4.5.
Version 5.0 Breaking Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. _java-breaking-changes-v5.0-connectionid:

- This driver version introduces the following changes to the ``ConnectionId`` class:

- The ``ConnectionId`` constructor now accepts a value of type ``long`` as its second
Expand All @@ -85,6 +87,21 @@ Version 5.0 Breaking Changes
- ``BsonProperty``
- ``BsonRepresentation``

- This driver version removes the ``Filters.eqFull()`` method, released
exclusively in ``Beta``, which allowed you
to construct an equality filter when performing a vector search.
You can use the ``Filters.eq()`` method when instantiating a
``VectorSearchOptions`` type, as shown in the following code:

.. code-block:: java

VectorSearchOptions opts = vectorSearchOptions().filter(eq("x", 8));

- The ``getServerValue()`` method now returns a value of type ``Long`` instead of type
``Integer``. Similarly, the ``getLocalValue()`` method returns a value of type
``long`` instead of type ``int``. Because this change breaks both binary and source
compatibility, update any source code that uses these methods and rebuild your binary.

- You must pass a timeout duration, which is the first parameter, to the
following ``SocketSettings`` builder methods as a ``long`` type:

Expand All @@ -94,9 +111,7 @@ Version 5.0 Breaking Changes
In earlier versions, this parameter is of type ``int`` for both methods. To view an example
that shows how to call ``SocketSettings`` methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings
guide.

This change breaks binary compatibility (requires recompiling) but does not
guide. This change breaks binary compatibility and requires recompiling, but does not
require code changes.

- This driver version removes the ``Filters.eqFull()`` method, released
Expand All @@ -107,7 +122,7 @@ Version 5.0 Breaking Changes

.. code-block:: java

VectorSearchOptions opts = vectorSearchOptions().filter(eq("x", 8));
VectorSearchOptions opts = vectorSearchOptions().filter(eq("x", 8));

.. _java-breaking-changes-v5.0-observables:

Expand Down
17 changes: 15 additions & 2 deletions source/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ What's New in 5.0

The 5.0 driver release introduces the following features:

- Changes to the ``ConnectionId`` class. To learn more, see the
:ref:`breaking change description <java-breaking-changes-v5.0-connectionid>`.

- The ``getElapsedTime()`` method on ``com.mongodb.event.ConnectionReadyEvent``
includes the time taken to deliver the ``ConnectionCreatedEvent``. That is,
the time returned includes the duration of the
Expand All @@ -64,8 +67,18 @@ The 5.0 driver release introduces the following features:
This relates to a :ref:`breaking change about Observables in this version
<java-breaking-changes-v5.0-observables>`.

- Changes to the ``ConnectionId`` class. To learn more, see the
:ref:`Version 5.0 Breaking Changes <java-breaking-changes-v5.0>`.
- The timeout parameters of the following ``SocketSettings``
builder methods is of ``long`` type:
Comment on lines +70 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: make parameters singular so it doesn't read like it's multiple for each one

Suggested change
- The timeout parameters of the following ``SocketSettings``
builder methods is of ``long`` type:
- The timeout parameter of the following ``SocketSettings``
builder methods is of ``long`` type:


- ``connectTimeout()``
- ``readTimeout()``

In earlier versions, this parameter is of type ``int`` for both methods. To
view an example that shows how to instantiate a ``SocketSettings`` instance by
using these methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings guide. This
correlates with a :ref:`binary breaking change
<java-breaking-changes-v5.0-socketsettings>`.

.. _version-4.11:

Expand Down