Skip to content

Commit

Permalink
Merge pull request Matthias247#65 from cognitree/name-threads
Browse files Browse the repository at this point in the history
name threads created by jawampa
  • Loading branch information
Matthias247 committed Aug 26, 2015
2 parents 219be8e + bf10c0b commit 34ee595
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.net.URI;
import java.util.List;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

import ws.wamp.jawampa.ApplicationError;
import ws.wamp.jawampa.WampRouter;
Expand Down Expand Up @@ -89,8 +91,19 @@ public SimpleWampWebsocketListener(WampRouter router, URI uri, SslContext sslCon
if (serializations == null || serializations.size() == 0 || serializations.contains(WampSerialization.Invalid))
throw new ApplicationError(ApplicationError.INVALID_SERIALIZATIONS);

this.bossGroup = new NioEventLoopGroup(1);
this.clientGroup = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors());
this.bossGroup = new NioEventLoopGroup(1, new ThreadFactory(){
@Override
public Thread newThread(Runnable r){
return new Thread(r, "WampRouterBossLoop");
}
});
this.clientGroup = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors(), new ThreadFactory(){
private AtomicInteger counter = new AtomicInteger();
@Override
public Thread newThread(Runnable r){
return new Thread(r, "WampRouterClientLoop-"+counter.incrementAndGet());
}
});

// Copy the ssl context only when we really want ssl
if (uri.getScheme().equalsIgnoreCase("wss")) {
Expand Down

0 comments on commit 34ee595

Please sign in to comment.