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;
25 import java.util.concurrent.TimeUnit;
26 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
31 public final class HashedWheelTimerModule extends
32 org.opendaylight.controller.config.yang.netty.timer.AbstractHashedWheelTimerModule {
34 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
35 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
36 super(identifier, dependencyResolver);
39 public HashedWheelTimerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
40 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
41 HashedWheelTimerModule oldModule, java.lang.AutoCloseable oldInstance) {
42 super(identifier, dependencyResolver, oldModule, oldInstance);
46 public void validate() {
48 if (getTickDuration() != null) {
49 JmxAttributeValidationException.checkCondition(getTickDuration() > 0, "value must be greater than 0",
50 tickDurationJmxAttribute);
52 if (getTicksPerWheel() != null) {
53 JmxAttributeValidationException.checkCondition(getTicksPerWheel() > 0, "value must be greater than 0",
54 ticksPerWheelJmxAttribute);
59 public java.lang.AutoCloseable createInstance() {
60 TimeUnit unit = TimeUnit.MILLISECONDS;
61 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() == null) {
62 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit));
64 if (getTickDuration() != null && getThreadFactoryDependency() == null && getTicksPerWheel() != null) {
65 return new HashedWheelTimerCloseable(new HashedWheelTimer(getTickDuration(), unit, getTicksPerWheel()));
67 if (getTickDuration() == null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
68 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency()));
70 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() == null) {
71 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
74 if (getTickDuration() != null && getThreadFactoryDependency() != null && getTicksPerWheel() != null) {
75 return new HashedWheelTimerCloseable(new HashedWheelTimer(getThreadFactoryDependency(), getTickDuration(),
76 unit, getTicksPerWheel()));
78 return new HashedWheelTimerCloseable(new HashedWheelTimer());
81 static final private class HashedWheelTimerCloseable implements AutoCloseable, Timer {
83 private final Timer timer;
85 public HashedWheelTimerCloseable(Timer timer) {
90 public void close() throws Exception {
95 public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
96 return this.timer.newTimeout(task, delay, unit);
100 public Set<Timeout> stop() {
101 return this.timer.stop();