File tree 2 files changed +15
-3
lines changed
src/main/java/org/java_websocket
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ protected void startConnectionLostTimer() {
201
201
private void restartConnectionLostTimer () {
202
202
cancelConnectionLostTimer ();
203
203
connectionLostCheckerService = Executors
204
- .newSingleThreadScheduledExecutor (new NamedThreadFactory ("connectionLostChecker" , daemon ));
204
+ .newSingleThreadScheduledExecutor (new NamedThreadFactory (connectionLostThreadPrefix () , daemon ));
205
205
Runnable connectionLostChecker = new Runnable () {
206
206
207
207
/**
@@ -233,6 +233,10 @@ public void run() {
233
233
TimeUnit .NANOSECONDS );
234
234
}
235
235
236
+ protected String connectionLostThreadPrefix () {
237
+ return "connectionLostChecker" ;
238
+ }
239
+
236
240
/**
237
241
* Send a ping to the endpoint or close the connection since the other endpoint did not respond
238
242
* with a ping
Original file line number Diff line number Diff line change @@ -380,10 +380,18 @@ public void connect() {
380
380
}
381
381
connectReadThread = new Thread (this );
382
382
connectReadThread .setDaemon (isDaemon ());
383
- connectReadThread .setName ("WebSocketConnectReadThread-" + connectReadThread .getId ());
383
+ connectReadThread .setName (connectReadThreadName ( connectReadThread .getId () ));
384
384
connectReadThread .start ();
385
385
}
386
386
387
+ protected String connectReadThreadName (long threadId ) {
388
+ return "WebSocketConnectReadThread-" + threadId ;
389
+ }
390
+
391
+ protected String writeThreadName (long threadId ) {
392
+ return "WebSocketWriteThread-" + threadId ;
393
+ }
394
+
387
395
/**
388
396
* Same as <code>connect</code> but blocks until the websocket connected or failed to do so.<br>
389
397
*
@@ -819,7 +827,7 @@ private class WebsocketWriteThread implements Runnable {
819
827
820
828
@ Override
821
829
public void run () {
822
- Thread .currentThread ().setName ("WebSocketWriteThread-" + Thread .currentThread ().getId ());
830
+ Thread .currentThread ().setName (writeThreadName ( Thread .currentThread ().getId () ));
823
831
try {
824
832
runWriteData ();
825
833
} catch (IOException e ) {
You can’t perform that action at this time.
0 commit comments