X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fnetty-timer-config%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fnetty%2Ftimer%2FOSGiGlobalTimer.java;fp=opendaylight%2Fconfig%2Fnetty-timer-config%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fnetty%2Ftimer%2FOSGiGlobalTimer.java;h=0000000000000000000000000000000000000000;hp=cb2eb708acf0eb1e5214809fee4f957b2b02097e;hb=9917911b1a492b5f9fbeef1591569f7fc4a80f68;hpb=77387f3590ca4c42c3ddce52131d5c00d2a3992d diff --git a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/OSGiGlobalTimer.java b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/OSGiGlobalTimer.java deleted file mode 100644 index cb2eb708ac..0000000000 --- a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/OSGiGlobalTimer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.config.yang.netty.timer; - -import io.netty.util.Timeout; -import io.netty.util.Timer; -import io.netty.util.TimerTask; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Deactivate; -import org.osgi.service.metatype.annotations.AttributeDefinition; -import org.osgi.service.metatype.annotations.Designate; -import org.osgi.service.metatype.annotations.ObjectClassDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Component(immediate = true, configurationPid = "org.opendaylight.netty.timer", property = "type=global-timer") -@Designate(ocd = OSGiGlobalTimer.Config.class) -public final class OSGiGlobalTimer implements Timer { - @ObjectClassDefinition - public @interface Config { - @AttributeDefinition(name = "tick-duration") - long tickDuration() default 0; - @AttributeDefinition(name = "ticks-per-wheel") - int ticksPerWheel() default 0; - } - - private static final Logger LOG = LoggerFactory.getLogger(OSGiGlobalTimer.class); - - private Timer delegate; - - @Activate - public OSGiGlobalTimer(final Config config) { - delegate = HashedWheelTimerCloseable.newInstance(config.tickDuration(), config.ticksPerWheel()); - LOG.info("Global Netty timer started"); - } - - @Deactivate - void deactivate() { - delegate.stop(); - delegate = null; - LOG.info("Global Netty timer stopped"); - } - - @Override - public Timeout newTimeout(final TimerTask task, final long delay, final TimeUnit unit) { - return delegate.newTimeout(task, delay, unit); - } - - @Override - public Set stop() { - LOG.warn("Attepted to stop global timer", new Throwable()); - return Set.of(); - } -}