Example usage for io.netty.util HashedWheelTimer stop

List of usage examples for io.netty.util HashedWheelTimer stop

Introduction

In this page you can find the example usage for io.netty.util HashedWheelTimer stop.

Prototype

@Override
    public Set<Timeout> stop() 

Source Link

Usage

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//w  w  w .  j a 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;
        }
    };
}