List of usage examples for io.netty.util.concurrent FastThreadLocalThread FastThreadLocalThread
public FastThreadLocalThread(Runnable target, String name)
From source file:herddb.client.HDBClient.java
License:Apache License
private void init() { int corePoolSize = configuration.getInt(ClientConfiguration.PROPERTY_CLIENT_CALLBACKS, ClientConfiguration.PROPERTY_CLIENT_CALLBACKS_DEFAULT); this.thredpool = new ThreadPoolExecutor(corePoolSize, Integer.MAX_VALUE, 120L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), (Runnable r) -> { Thread t = new FastThreadLocalThread(r, "hdb-client"); t.setDaemon(true);/*from w w w .java2s .c om*/ return t; }); this.networkGroup = NetworkUtils.isEnableEpoolNative() ? new EpollEventLoopGroup() : new NioEventLoopGroup(); this.localEventsGroup = new DefaultEventLoopGroup(); String mode = configuration.getString(ClientConfiguration.PROPERTY_MODE, ClientConfiguration.PROPERTY_MODE_LOCAL); switch (mode) { case ClientConfiguration.PROPERTY_MODE_LOCAL: case ClientConfiguration.PROPERTY_MODE_STANDALONE: this.clientSideMetadataProvider = new StaticClientSideMetadataProvider( configuration.getString(ClientConfiguration.PROPERTY_SERVER_ADDRESS, ClientConfiguration.PROPERTY_SERVER_ADDRESS_DEFAULT), configuration.getInt(ClientConfiguration.PROPERTY_SERVER_PORT, ClientConfiguration.PROPERTY_SERVER_PORT_DEFAULT), configuration.getBoolean(ClientConfiguration.PROPERTY_SERVER_SSL, ClientConfiguration.PROPERTY_SERVER_SSL_DEFAULT)); break; case ClientConfiguration.PROPERTY_MODE_CLUSTER: this.clientSideMetadataProvider = new ZookeeperClientSideMetadataProvider( configuration.getString(ClientConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, ClientConfiguration.PROPERTY_ZOOKEEPER_ADDRESS_DEFAULT), configuration.getInt(ClientConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, ClientConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT_DEFAULT), configuration.getString(ClientConfiguration.PROPERTY_ZOOKEEPER_PATH, ClientConfiguration.PROPERTY_ZOOKEEPER_PATH_DEFAULT)); break; default: throw new IllegalStateException(mode); } }
From source file:org.apache.cassandra.concurrent.SEPWorker.java
License:Apache License
SEPWorker(Long workerId, Work initialState, SharedExecutorPool pool) {
this.pool = pool;
this.workerId = workerId;
thread = new FastThreadLocalThread(this, pool.poolName + "-Worker-" + workerId);
thread.setDaemon(true);/*from ww w. ja v a 2 s.c o m*/
set(initialState);
thread.start();
}