Skip to content

Commit 4804533

Browse files
miklishMichael Christoff
and
Michael Christoff
authored
make simplepool thread names generic (not related to http/1.1 or http/2 (#2090)
Co-authored-by: Michael Christoff <[email protected]>
1 parent f87c2f0 commit 4804533

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

client/src/main/java/com/networknt/client/simplepool/undertow/SimpleUndertowConnectionMaker.java

+8-10
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public SimpleConnection makeConnection(
6969
final Set<SimpleConnection> allCreatedConnections) throws RuntimeException
7070
{
7171
boolean isHttps = uri.getScheme().equalsIgnoreCase("https");
72-
XnioWorker worker = getWorker(isHttp2);
73-
XnioSsl ssl = getSSL(isHttps, isHttp2);
72+
XnioWorker worker = getWorker();
73+
XnioSsl ssl = getSSL(isHttps);
7474
OptionMap connectionOptions = getConnectionOptions(isHttp2);
7575
InetSocketAddress bindAddress = null;
7676

@@ -138,10 +138,9 @@ private static OptionMap getConnectionOptions(boolean isHttp2) {
138138
* WARNING: This is called by getSSL(). Therefore, this method must never
139139
* call getSSL(), or any method that transitively calls getSSL()
140140
*
141-
* @param isHttp2 if true, sets worker thread names to show HTTP2
142141
* @return new XnioWorker
143142
*/
144-
private static XnioWorker getWorker(boolean isHttp2)
143+
private static XnioWorker getWorker()
145144
{
146145
if(WORKER.get() != null) return WORKER.get();
147146

@@ -151,7 +150,7 @@ private static XnioWorker getWorker(boolean isHttp2)
151150

152151
Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
153152
try {
154-
WORKER.set(xnio.createWorker(null, getWorkerOptionMap(isHttp2)));
153+
WORKER.set(xnio.createWorker(null, getWorkerOptionMap()));
155154
} catch (IOException e) {
156155
logger.error("Exception while creating new XnioWorker", e);
157156
throw new RuntimeException(e);
@@ -160,13 +159,13 @@ private static XnioWorker getWorker(boolean isHttp2)
160159
return WORKER.get();
161160
}
162161

163-
private static OptionMap getWorkerOptionMap(boolean isHttp2)
162+
private static OptionMap getWorkerOptionMap()
164163
{
165164
OptionMap.Builder optionBuild = OptionMap.builder()
166165
.set(Options.WORKER_IO_THREADS, 8)
167166
.set(Options.TCP_NODELAY, true)
168167
.set(Options.KEEP_ALIVE, true)
169-
.set(Options.WORKER_NAME, isHttp2 ? "Callback-HTTP2" : "Callback-HTTP11");
168+
.set(Options.WORKER_NAME, "simplepool");
170169
return optionBuild.getMap();
171170
}
172171

@@ -176,10 +175,9 @@ private static OptionMap getWorkerOptionMap(boolean isHttp2)
176175
* WARNING: This calls getWorker()
177176
*
178177
* @param isHttps true if this is an HTTPS connection
179-
* @param isHttp2 if true, sets worker thread names to show HTTP2
180178
* @return new XnioSSL
181179
*/
182-
private static XnioSsl getSSL(boolean isHttps, boolean isHttp2)
180+
private static XnioSsl getSSL(boolean isHttps)
183181
{
184182
if(!isHttps) return null;
185183
if(SSL.get() != null) return SSL.get();
@@ -189,7 +187,7 @@ private static XnioSsl getSSL(boolean isHttps, boolean isHttp2)
189187
if(SSL.get() != null) return SSL.get();
190188

191189
try {
192-
SSL.set(new UndertowXnioSsl(getWorker(isHttp2).getXnio(), OptionMap.EMPTY, BUFFER_POOL, SimpleSSLContextMaker.createSSLContext()));
190+
SSL.set(new UndertowXnioSsl(getWorker().getXnio(), OptionMap.EMPTY, BUFFER_POOL, SimpleSSLContextMaker.createSSLContext()));
193191
} catch (Exception e) {
194192
logger.error("Exception while creating new shared UndertowXnioSsl used to create connections", e);
195193
throw new RuntimeException(e);

0 commit comments

Comments
 (0)