4 * Generated from: yang module name: netty-event-executor yang module local name: netty-hashed-wheel-timer
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Tue Nov 19 12:49:59 CET 2013
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.controller.config.yang.netty.timer;
12 import io.netty.util.HashedWheelTimer;
13 import io.netty.util.Timeout;
14 import io.netty.util.Timer;
15 import io.netty.util.TimerTask;
18 import java.util.concurrent.TimeUnit;
20 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
25 public final class HashedWheelTimerModule extends
26 org.opendaylight.controller.config.yang.netty.timer.AbstractHashedWheelTimerModule {
28 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
29 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
30 super(identifier, dependencyResolver);
33 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
34 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
35 HashedWheelTimerModule oldModule, java.lang.AutoCloseable oldInstance) {
36 super(identifier, dependencyResolver, oldModule, oldInstance);
40 public void validate() {
42 if (getTickDuration() != null) {
43 JmxAttributeValidationException.checkCondition(getTickDuration() > 0, "value must be greater than 0",
44 tickDurationJmxAttribute);
46 if (getTicksPerWheel() != null) {
47 JmxAttributeValidationException.checkCondition(getTicksPerWheel() > 0, "value must be greater than 0",
48 ticksPerWheelJmxAttribute);
53 public java.lang.AutoCloseable createInstance() {
54 TimeUnit unit = TimeUnit.MILLISECONDS;
55 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() == null) {
56 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit));
58 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() != null) {
59 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit, getTicksPerWheel()));
61 if (getTickDuration() == null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
62 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency()));
64 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
65 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
68 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() != null) {
69 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
70 unit, getTicksPerWheel()));
72 return new HashedWheelTimerCloseable(new HashedWheelTimer());
75 static final private class HashedWheelTimerCloseable implements AutoCloseable, Timer {
77 private final Timer timer;
79 public HashedWheelTimerCloseable(Timer timer) {
84 public void close() throws Exception {
89 public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
90 return this.timer.newTimeout(task, delay, unit);
94 public Set<Timeout> stop() {
95 return this.timer.stop();