|
29 | 29 | import com.github.akurilov.netty.connection.pool.MultiNodeConnPoolImpl; |
30 | 30 | import com.github.akurilov.netty.connection.pool.NonBlockingConnPool; |
31 | 31 | import io.netty.bootstrap.Bootstrap; |
| 32 | +import io.netty.buffer.PooledByteBufAllocator; |
32 | 33 | import io.netty.channel.Channel; |
33 | 34 | import io.netty.channel.ChannelFuture; |
34 | 35 | import io.netty.channel.ChannelFutureListener; |
|
45 | 46 | import io.netty.handler.ssl.SslProvider; |
46 | 47 | import io.netty.handler.ssl.util.InsecureTrustManagerFactory; |
47 | 48 | import io.netty.handler.timeout.IdleStateHandler; |
48 | | -import io.netty.util.AttributeKey; |
49 | 49 |
|
50 | 50 | import java.io.IOException; |
51 | 51 | import java.net.ConnectException; |
52 | 52 | import java.net.InetSocketAddress; |
53 | | -import java.security.NoSuchAlgorithmException; |
54 | | -import java.util.Arrays; |
55 | 53 | import java.util.List; |
56 | 54 | import java.util.concurrent.ThreadFactory; |
57 | 55 | import java.util.concurrent.TimeUnit; |
58 | 56 | import org.apache.logging.log4j.CloseableThreadContext; |
59 | 57 | import org.apache.logging.log4j.Level; |
60 | 58 | import org.apache.logging.log4j.ThreadContext; |
61 | 59 |
|
62 | | -import javax.net.ssl.SSLContext; |
63 | 60 | import javax.net.ssl.SSLException; |
64 | 61 |
|
65 | 62 | /** Created by kurila on 30.09.16. */ |
@@ -102,23 +99,14 @@ protected NettyStorageDriverBase( |
102 | 99 | final var provider = SslProvider.valueOf(providerName); |
103 | 100 | Loggers.MSG.info("{}: SSL/TLS provider: {}", stepId, providerName); |
104 | 101 | try { |
105 | | - final var supportedCiphers = Arrays.asList(SSLContext |
106 | | - .getDefault() |
107 | | - .getServerSocketFactory() |
108 | | - .getSupportedCipherSuites()); |
109 | | - final var ciphers = (userCiphers == null) ? supportedCiphers : userCiphers; |
110 | | - Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, ciphers); |
111 | 102 | sslCtx = SslContextBuilder |
112 | 103 | .forClient() |
113 | 104 | .trustManager(InsecureTrustManagerFactory.INSTANCE) |
114 | 105 | .sslProvider(provider) |
115 | 106 | .protocols(protocols.toArray(new String[]{})) |
116 | | - .ciphers(ciphers) |
| 107 | + .ciphers(userCiphers) |
117 | 108 | .build(); |
118 | | - } catch (final NoSuchAlgorithmException e) { |
119 | | - throw new IllegalConfigurationException( |
120 | | - "Failed to get the list of the supported SSL/TLS cipher suites", e |
121 | | - ); |
| 109 | + Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, sslCtx.cipherSuites()); |
122 | 110 | } catch (final SSLException e) { |
123 | 111 | throw new IllegalConfigurationException("Failed to build the SSL context", e); |
124 | 112 | } |
@@ -163,6 +151,7 @@ protected NettyStorageDriverBase( |
163 | 151 | } else { |
164 | 152 | transportKey = Transport.valueOf(transportConfig.toUpperCase()); |
165 | 153 | } |
| 154 | + Loggers.MSG.info("{}: netty transport: {}", toString(), transportKey); |
166 | 155 |
|
167 | 156 | try { |
168 | 157 |
|
@@ -193,13 +182,13 @@ protected NettyStorageDriverBase( |
193 | 182 | } |
194 | 183 |
|
195 | 184 | bootstrap = new Bootstrap().group(ioExecutor).channel(socketChannelCls); |
196 | | - // bootstrap.option(ChannelOption.ALLOCATOR, ByteBufAllocator) |
| 185 | + bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); |
197 | 186 | // bootstrap.option(ChannelOption.ALLOW_HALF_CLOSURE) |
198 | 187 | // bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, ) |
199 | 188 | // bootstrap.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR) |
200 | 189 | // bootstrap.option(ChannelOption.AUTO_READ) |
201 | 190 | bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, netConfig.intVal("timeoutMilliSec")); |
202 | | - bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 1); |
| 191 | + bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 32); |
203 | 192 | int size = netConfig.intVal("rcvBuf"); |
204 | 193 | if (size > 0) { |
205 | 194 | bootstrap.option(ChannelOption.SO_RCVBUF, size); |
|
0 commit comments