Skip to content

Commit 7c33063

Browse files
committed
Recommend against replacing SocketConfigurator
Use andThen(SocketConfigurator) on the existing one instead, to avoid replacing existing important behavior. (cherry picked from commit 2d09944)
1 parent 43263bc commit 7c33063

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,13 @@ public SocketConfigurator getSocketConfigurator() {
720720
* Set the socket configurator. This gets a chance to "configure" a socket before it has been
721721
* opened. The default socket configurator disables Nagle's algorithm.
722722
*
723+
* <p>Avoid setting the socket configurator directly with this method, as it can replace an
724+
* existing socket configurator that performs important work (like disabling Nagle's algorithm or
725+
* using hostname verification with TLS).
726+
*
727+
* <p>Prefer <em>adding</em> some behavior by using {@link #getSocketConfigurator()} and calling
728+
* {@link com.rabbitmq.client.SocketConfigurator#andThen(SocketConfigurator)}.
729+
*
723730
* @param socketConfigurator the configurator to use
724731
*/
725732
public void setSocketConfigurator(SocketConfigurator socketConfigurator) {

0 commit comments

Comments
 (0)