1818import static java .util .concurrent .TimeUnit .MINUTES ;
1919
2020import com .rabbitmq .client .impl .*;
21- import com .rabbitmq .client .impl .nio .NioParams ;
22- import com .rabbitmq .client .impl .nio .SocketChannelFrameHandlerFactory ;
2321import com .rabbitmq .client .impl .recovery .AutorecoveringConnection ;
2422import com .rabbitmq .client .impl .recovery .RecoveredQueueNameSupplier ;
2523import com .rabbitmq .client .impl .recovery .RetryHandler ;
@@ -154,11 +152,9 @@ public class ConnectionFactory implements Cloneable {
154152 private MetricsCollector metricsCollector ;
155153 private ObservationCollector observationCollector = ObservationCollector .NO_OP ;
156154
157- private boolean nio = false ;
158155 private boolean netty = false ;
159156 private FrameHandlerFactory frameHandlerFactory ;
160157 private final NettyConfiguration nettyConf = new NettyConfiguration (this );
161- private NioParams nioParams = new NioParams ();
162158
163159 private SslContextFactory sslContextFactory ;
164160
@@ -917,9 +913,6 @@ public ConnectionFactory useSslProtocol(SSLContext context) {
917913 * com.rabbitmq.client.ConnectionFactory.NettyConfiguration#sslContext(io.netty.handler.ssl.SslContext)}
918914 * instead.
919915 *
920- * @see NioParams#enableHostnameVerification()
921- * @see NioParams#setSslEngineConfigurator(SslEngineConfigurator)
922- * @see SslEngineConfigurators#ENABLE_HOSTNAME_VERIFICATION
923916 * @see SocketConfigurators#ENABLE_HOSTNAME_VERIFICATION
924917 * @see ConnectionFactory#useSslProtocol(String)
925918 * @see ConnectionFactory#useSslProtocol(SSLContext)
@@ -928,18 +921,10 @@ public ConnectionFactory useSslProtocol(SSLContext context) {
928921 * @since 5.4.0
929922 */
930923 public ConnectionFactory enableHostnameVerification () {
931- enableHostnameVerificationForNio ();
932924 enableHostnameVerificationForBlockingIo ();
933925 return this ;
934926 }
935927
936- protected void enableHostnameVerificationForNio () {
937- if (this .nioParams == null ) {
938- this .nioParams = new NioParams ();
939- }
940- this .nioParams = this .nioParams .enableHostnameVerification ();
941- }
942-
943928 protected void enableHostnameVerificationForBlockingIo () {
944929 if (this .socketConf == null ) {
945930 this .socketConf =
@@ -1076,21 +1061,7 @@ public ConnectionFactory setCredentialsRefreshService(
10761061 }
10771062
10781063 protected synchronized FrameHandlerFactory createFrameHandlerFactory () throws IOException {
1079- if (nio ) {
1080- if (this .frameHandlerFactory == null ) {
1081- if (this .nioParams .getNioExecutor () == null && this .nioParams .getThreadFactory () == null ) {
1082- this .nioParams .setThreadFactory (getThreadFactory ());
1083- }
1084- this .frameHandlerFactory =
1085- new SocketChannelFrameHandlerFactory (
1086- connectionTimeout ,
1087- nioParams ,
1088- isSSL (),
1089- sslContextFactory ,
1090- this .maxInboundMessageBodySize );
1091- }
1092- return this .frameHandlerFactory ;
1093- } else if (netty ) {
1064+ if (netty ) {
10941065 if (this .frameHandlerFactory == null ) {
10951066 this .frameHandlerFactory =
10961067 new NettyFrameHandlerFactory (
@@ -1659,59 +1630,11 @@ public ConnectionFactory setRecoveryDelayHandler(
16591630 return this ;
16601631 }
16611632
1662- /**
1663- * Sets the parameters when using NIO.
1664- *
1665- * @param nioParams
1666- * @see NioParams
1667- * @deprecated user {@link #netty()} instead
1668- */
1669- @ Deprecated
1670- public ConnectionFactory setNioParams (NioParams nioParams ) {
1671- this .nioParams = nioParams ;
1672- return this ;
1673- }
1674-
1675- /**
1676- * Retrieve the parameters for NIO mode.
1677- *
1678- * @return
1679- * @deprecated Use {@link #netty()}
1680- */
1681- @ Deprecated
1682- public NioParams getNioParams () {
1683- return nioParams ;
1684- }
1685-
1686- /**
1687- * Use non-blocking IO (NIO) for communication with the server. With NIO, several connections
1688- * created from the same {@link ConnectionFactory} can use the same IO thread.
1689- *
1690- * <p>A client process using a lot of not-so-active connections can benefit from NIO, as it would
1691- * use fewer threads than with the traditional, blocking IO mode.
1692- *
1693- * <p>Use {@link NioParams} to tune NIO and a {@link SocketChannelConfigurator} to configure the
1694- * underlying {@link java.nio.channels.SocketChannel}s for connections.
1695- *
1696- * @see NioParams
1697- * @see SocketChannelConfigurator
1698- * @see java.nio.channels.SocketChannel
1699- * @see java.nio.channels.Selector
1700- * @deprecated Use {@link #netty()} instead
1701- */
1702- @ Deprecated
1703- public ConnectionFactory useNio () {
1704- this .nio = true ;
1705- this .netty = false ;
1706- return this ;
1707- }
1708-
17091633 /**
17101634 * Use blocking IO for communication with the server. With blocking IO, each connection creates
17111635 * its own thread to read data from the server.
17121636 */
17131637 public ConnectionFactory useBlockingIo () {
1714- this .nio = false ;
17151638 this .netty = false ;
17161639 return this ;
17171640 }
@@ -1885,7 +1808,6 @@ public ConnectionFactory setTrafficListener(TrafficListener trafficListener) {
18851808
18861809 private ConnectionFactory useNetty () {
18871810 this .netty = true ;
1888- this .nio = false ;
18891811 return this ;
18901812 }
18911813
0 commit comments