18
18
import static java .util .concurrent .TimeUnit .MINUTES ;
19
19
20
20
import com .rabbitmq .client .impl .*;
21
- import com .rabbitmq .client .impl .nio .NioParams ;
22
- import com .rabbitmq .client .impl .nio .SocketChannelFrameHandlerFactory ;
23
21
import com .rabbitmq .client .impl .recovery .AutorecoveringConnection ;
24
22
import com .rabbitmq .client .impl .recovery .RecoveredQueueNameSupplier ;
25
23
import com .rabbitmq .client .impl .recovery .RetryHandler ;
@@ -154,11 +152,9 @@ public class ConnectionFactory implements Cloneable {
154
152
private MetricsCollector metricsCollector ;
155
153
private ObservationCollector observationCollector = ObservationCollector .NO_OP ;
156
154
157
- private boolean nio = false ;
158
155
private boolean netty = false ;
159
156
private FrameHandlerFactory frameHandlerFactory ;
160
157
private final NettyConfiguration nettyConf = new NettyConfiguration (this );
161
- private NioParams nioParams = new NioParams ();
162
158
163
159
private SslContextFactory sslContextFactory ;
164
160
@@ -917,9 +913,6 @@ public ConnectionFactory useSslProtocol(SSLContext context) {
917
913
* com.rabbitmq.client.ConnectionFactory.NettyConfiguration#sslContext(io.netty.handler.ssl.SslContext)}
918
914
* instead.
919
915
*
920
- * @see NioParams#enableHostnameVerification()
921
- * @see NioParams#setSslEngineConfigurator(SslEngineConfigurator)
922
- * @see SslEngineConfigurators#ENABLE_HOSTNAME_VERIFICATION
923
916
* @see SocketConfigurators#ENABLE_HOSTNAME_VERIFICATION
924
917
* @see ConnectionFactory#useSslProtocol(String)
925
918
* @see ConnectionFactory#useSslProtocol(SSLContext)
@@ -928,18 +921,10 @@ public ConnectionFactory useSslProtocol(SSLContext context) {
928
921
* @since 5.4.0
929
922
*/
930
923
public ConnectionFactory enableHostnameVerification () {
931
- enableHostnameVerificationForNio ();
932
924
enableHostnameVerificationForBlockingIo ();
933
925
return this ;
934
926
}
935
927
936
- protected void enableHostnameVerificationForNio () {
937
- if (this .nioParams == null ) {
938
- this .nioParams = new NioParams ();
939
- }
940
- this .nioParams = this .nioParams .enableHostnameVerification ();
941
- }
942
-
943
928
protected void enableHostnameVerificationForBlockingIo () {
944
929
if (this .socketConf == null ) {
945
930
this .socketConf =
@@ -1076,21 +1061,7 @@ public ConnectionFactory setCredentialsRefreshService(
1076
1061
}
1077
1062
1078
1063
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 ) {
1094
1065
if (this .frameHandlerFactory == null ) {
1095
1066
this .frameHandlerFactory =
1096
1067
new NettyFrameHandlerFactory (
@@ -1659,59 +1630,11 @@ public ConnectionFactory setRecoveryDelayHandler(
1659
1630
return this ;
1660
1631
}
1661
1632
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
-
1709
1633
/**
1710
1634
* Use blocking IO for communication with the server. With blocking IO, each connection creates
1711
1635
* its own thread to read data from the server.
1712
1636
*/
1713
1637
public ConnectionFactory useBlockingIo () {
1714
- this .nio = false ;
1715
1638
this .netty = false ;
1716
1639
return this ;
1717
1640
}
@@ -1885,7 +1808,6 @@ public ConnectionFactory setTrafficListener(TrafficListener trafficListener) {
1885
1808
1886
1809
private ConnectionFactory useNetty () {
1887
1810
this .netty = true ;
1888
- this .nio = false ;
1889
1811
return this ;
1890
1812
}
1891
1813
0 commit comments