List of usage examples for io.netty.util HashedWheelTimer start
public void start()
From source file:org.apache.bookkeeper.clients.utils.ClientResources.java
License:Apache License
private ClientResources() { this.scheduler = new Resource<OrderedScheduler>() { private static final String name = "client-scheduler"; @Override/*from w ww . j a v a 2 s.c o m*/ public OrderedScheduler create() { return OrderedScheduler.newSchedulerBuilder() .numThreads(Runtime.getRuntime().availableProcessors() * 2).name(name).build(); } @Override public void close(OrderedScheduler instance) { instance.shutdown(); } @Override public String toString() { return name; } }; this.timer = new Resource<HashedWheelTimer>() { private static final String name = "client-timer"; @Override public HashedWheelTimer create() { HashedWheelTimer timer = new HashedWheelTimer( new ThreadFactoryBuilder().setNameFormat(name + "-%d").build(), 200, TimeUnit.MILLISECONDS, 512, true); timer.start(); return timer; } @Override public void close(HashedWheelTimer instance) { instance.stop(); } @Override public String toString() { return name; } }; this.executor = new Resource<ExecutorService>() { private static final String name = "stream-client-executor"; @Override public ExecutorService create() { return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2); } @Override public void close(ExecutorService instance) { instance.shutdown(); } @Override public String toString() { return name; } }; }
From source file:org.apache.bookkeeper.stream.storage.StorageResources.java
License:Apache License
private StorageResources(StorageResourcesSpec spec) { this.scheduler = createSchedulerResource("storage-scheduler", spec.numSchedulerThreads()); this.ioWriteScheduler = createSchedulerResource("io-write-scheduler", spec.numIOWriteThreads()); this.ioReadScheduler = createSchedulerResource("io-read-scheduler", spec.numIOReadThreads()); this.checkpointScheduler = createSchedulerResource("io-checkpoint-scheduler", spec.numCheckpointThreads()); this.timer = new Resource<HashedWheelTimer>() { private static final String name = "storage-timer"; @Override//from w w w . ja v a2 s. c o m public HashedWheelTimer create() { HashedWheelTimer timer = new HashedWheelTimer( new ThreadFactoryBuilder().setNameFormat(name + "-%d").build(), 200, TimeUnit.MILLISECONDS, 512, true); timer.start(); return timer; } @Override public void close(HashedWheelTimer instance) { instance.stop(); } @Override public String toString() { return name; } }; }
From source file:org.asynchttpclient.DefaultAsyncHttpClient.java
License:Apache License
private Timer newNettyTimer() { HashedWheelTimer timer = new HashedWheelTimer(); timer.start(); return timer; }
From source file:org.asynchttpclient.providers.netty.channel.Channels.java
License:Apache License
private Timer newNettyTimer() { HashedWheelTimer nettyTimer = new HashedWheelTimer(); nettyTimer.start(); return nettyTimer; }
From source file:org.onlab.util.Timer.java
License:Apache License
private static synchronized void initTimer() { if (Timer.timer == null) { org.jboss.netty.util.HashedWheelTimer hwTimer = new org.jboss.netty.util.HashedWheelTimer(); hwTimer.start(); Timer.timer = hwTimer;//from w w w . j a va 2 s . co m } }