2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
12 * Generated from: yang module name: netty-event-executor yang module local name: netty-hashed-wheel-timer
13 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
14 * Generated at: Tue Nov 19 12:49:59 CET 2013
16 * Do not modify this file unless it is present under src/main directory
18 package org.opendaylight.controller.config.yang.netty.timer;
20 import io.netty.util.HashedWheelTimer;
21 import io.netty.util.Timeout;
22 import io.netty.util.Timer;
23 import io.netty.util.TimerTask;
26 import java.util.concurrent.TimeUnit;
28 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
33 public final class HashedWheelTimerModule extends
34 org.opendaylight.controller.config.yang.netty.timer.AbstractHashedWheelTimerModule {
36 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
37 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
38 super(identifier, dependencyResolver);
41 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
42 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
43 HashedWheelTimerModule oldModule, java.lang.AutoCloseable oldInstance) {
44 super(identifier, dependencyResolver, oldModule, oldInstance);
48 public void validate() {
50 if (getTickDuration() != null) {
51 JmxAttributeValidationException.checkCondition(getTickDuration() > 0, "value must be greater than 0",
52 tickDurationJmxAttribute);
54 if (getTicksPerWheel() != null) {
55 JmxAttributeValidationException.checkCondition(getTicksPerWheel() > 0, "value must be greater than 0",
56 ticksPerWheelJmxAttribute);
61 public java.lang.AutoCloseable createInstance() {
62 TimeUnit unit = TimeUnit.MILLISECONDS;
63 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() == null) {
64 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit));
66 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() != null) {
67 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit, getTicksPerWheel()));
69 if (getTickDuration() == null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
70 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency()));
72 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
73 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
76 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() != null) {
77 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
78 unit, getTicksPerWheel()));
80 return new HashedWheelTimerCloseable(new HashedWheelTimer());
83 static final private class HashedWheelTimerCloseable implements AutoCloseable, Timer {
85 private final Timer timer;
87 public HashedWheelTimerCloseable(Timer timer) {
92 public void close() throws Exception {
97 public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
98 return this.timer.newTimeout(task, delay, unit);
102 public Set<Timeout> stop() {
103 return this.timer.stop();