Skip to content

Commit

Permalink
feat(nats-connection): implement named executor thread factories
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysiekigry committed Nov 20, 2024
1 parent 2175501 commit 66a1fde
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/main/java/io/nats/client/impl/NatsConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,22 @@ class NatsConnection implements Connection {

timeTraceLogger.trace("creating executors");
this.executor = options.getExecutor();
this.callbackRunner = Executors.newSingleThreadExecutor();
this.connectExecutor = Executors.newSingleThreadExecutor();
this.callbackRunner = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setName("nats-callback-runner");
return t;
}
});
this.connectExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setName("nats-connect-executor");
return t;
}
});

timeTraceLogger.trace("creating reader and writer");
this.reader = new NatsConnectionReader(this);
Expand Down

0 comments on commit 66a1fde

Please sign in to comment.