From 9917911b1a492b5f9fbeef1591569f7fc4a80f68 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 20 Jan 2024 14:14:52 +0100 Subject: [PATCH] Remove odl-controller-exp-netty-config Remove all of configuration remnants, as there is just a single downstream user. JIRA: CONTROLLER-2092 Change-Id: I2d0bb01cfd061c2f0086fcc80b27e6b0a336e5dc Signed-off-by: Robert Varga --- artifacts/pom.xml | 48 +---- docs/pom.xml | 22 -- .../features-controller-experimental/pom.xml | 6 - .../odl-controller-exp-netty-config/pom.xml | 51 ----- .../src/main/feature/feature.xml | 13 -- features/pom.xml | 5 +- .../netty-event-executor-config/pom.xml | 33 --- .../AutoCloseableEventExecutor.java | 41 ---- .../OSGiGlobalEventExecutor.java | 202 ------------------ .../config/netty-threadgroup-config/pom.xml | 37 ---- .../threadgroup/AbstractGlobalGroup.java | 22 -- .../yang/netty/threadgroup/Configuration.java | 20 -- .../netty/threadgroup/GlobalBossGroup.java | 28 --- .../netty/threadgroup/GlobalWorkerGroup.java | 28 --- .../yang/netty/threadgroup/package-info.java | 9 - .../config/netty-timer-config/pom.xml | 37 ---- .../timer/HashedWheelTimerCloseable.java | 78 ------- .../yang/netty/timer/OSGiGlobalTimer.java | 62 ------ opendaylight/config/pom.xml | 28 --- .../config/threadpool-config-api/pom.xml | 17 -- .../threadpool/ScheduledThreadPool.java | 20 -- .../config/threadpool/ThreadPool.java | 21 -- .../config/threadpool-config-impl/pom.xml | 40 ---- .../util/FixedThreadPoolWrapper.java | 50 ----- .../util/FlexibleThreadPoolWrapper.java | 138 ------------ .../util/NamingThreadPoolFactory.java | 43 ---- .../util/ScheduledThreadPoolWrapper.java | 48 ----- pom.xml | 6 +- 28 files changed, 10 insertions(+), 1143 deletions(-) delete mode 100644 features/odl-controller-exp-netty-config/pom.xml delete mode 100644 features/odl-controller-exp-netty-config/src/main/feature/feature.xml delete mode 100644 opendaylight/config/netty-event-executor-config/pom.xml delete mode 100644 opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java delete mode 100644 opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/OSGiGlobalEventExecutor.java delete mode 100644 opendaylight/config/netty-threadgroup-config/pom.xml delete mode 100644 opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/AbstractGlobalGroup.java delete mode 100644 opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/Configuration.java delete mode 100644 opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalBossGroup.java delete mode 100644 opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalWorkerGroup.java delete mode 100644 opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/package-info.java delete mode 100644 opendaylight/config/netty-timer-config/pom.xml delete mode 100644 opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java delete mode 100644 opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/OSGiGlobalTimer.java delete mode 100644 opendaylight/config/pom.xml delete mode 100644 opendaylight/config/threadpool-config-api/pom.xml delete mode 100644 opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java delete mode 100644 opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java delete mode 100644 opendaylight/config/threadpool-config-impl/pom.xml delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java delete mode 100644 opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java diff --git a/artifacts/pom.xml b/artifacts/pom.xml index d992ba7fac..f5d0bc9ce7 100644 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -32,6 +32,13 @@ ${project.version} + + + ${project.groupId} + atomix-storage + ${project.version} + + ${project.groupId} @@ -390,47 +397,6 @@ features xml - - - - ${project.groupId} - netty-event-executor-config - 0.20.0-SNAPSHOT - - - ${project.groupId} - netty-threadgroup-config - 0.20.0-SNAPSHOT - - - ${project.groupId} - netty-timer-config - 0.20.0-SNAPSHOT - - - ${project.groupId} - threadpool-config-api - 0.20.0-SNAPSHOT - - - ${project.groupId} - threadpool-config-impl - 0.20.0-SNAPSHOT - - - ${project.groupId} - odl-controller-exp-netty-config - ${project.version} - features - xml - - - - - ${project.groupId} - atomix-storage - ${project.version} - diff --git a/docs/pom.xml b/docs/pom.xml index 39a80ebb70..bf9ac75932 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -36,28 +36,6 @@ - - - org.opendaylight.controller - netty-event-executor-config - - - org.opendaylight.controller - netty-threadgroup-config - - - org.opendaylight.controller - netty-timer-config - - - org.opendaylight.controller - threadpool-config-api - - - org.opendaylight.controller - threadpool-config-impl - - org.opendaylight.controller diff --git a/features/features-controller-experimental/pom.xml b/features/features-controller-experimental/pom.xml index ad3ea2a93d..235a920909 100644 --- a/features/features-controller-experimental/pom.xml +++ b/features/features-controller-experimental/pom.xml @@ -35,12 +35,6 @@ - - org.opendaylight.controller - odl-controller-exp-netty-config - xml - features - org.opendaylight.controller odl-toaster diff --git a/features/odl-controller-exp-netty-config/pom.xml b/features/odl-controller-exp-netty-config/pom.xml deleted file mode 100644 index 89058d1c14..0000000000 --- a/features/odl-controller-exp-netty-config/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.controller - single-feature-parent - 9.0.0-SNAPSHOT - ../single-feature-parent - - - odl-controller-exp-netty-config - feature - OpenDaylight :: Controller :: Experimental :: Netty Configuration - Common configuration for Netty resources - - - - org.opendaylight.odlparent - odl-netty-4 - xml - features - - - org.opendaylight.controller - netty-event-executor-config - - - org.opendaylight.controller - netty-threadgroup-config - - - org.opendaylight.controller - netty-timer-config - - - org.opendaylight.controller - threadpool-config-api - - - org.opendaylight.controller - threadpool-config-impl - - - diff --git a/features/odl-controller-exp-netty-config/src/main/feature/feature.xml b/features/odl-controller-exp-netty-config/src/main/feature/feature.xml deleted file mode 100644 index 866b352d94..0000000000 --- a/features/odl-controller-exp-netty-config/src/main/feature/feature.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - odl-netty-4 - - diff --git a/features/pom.xml b/features/pom.xml index c2aa4f200f..c51c4a2ca6 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -34,7 +34,7 @@ features-controller-experimental - odl-controller-exp-netty-config + odl-toaster features-controller-testing @@ -47,13 +47,12 @@ odl-controller-blueprint + odl-controller-broker-local odl-controller-mdsal-common odl-jolokia - odl-controller-broker-local odl-mdsal-broker odl-mdsal-clustering-commons odl-mdsal-distributed-datastore odl-mdsal-remoterpc-connector - odl-toaster diff --git a/opendaylight/config/netty-event-executor-config/pom.xml b/opendaylight/config/netty-event-executor-config/pom.xml deleted file mode 100644 index 20e52eb4f3..0000000000 --- a/opendaylight/config/netty-event-executor-config/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - bundle-parent - 13.0.10 - - - - org.opendaylight.controller - netty-event-executor-config - 0.20.0-SNAPSHOT - bundle - ${project.artifactId} - Configuration Wrapper around netty's event executor - - - - com.google.guava - guava - - - io.netty - netty-common - - - org.osgi - org.osgi.service.component.annotations - - - diff --git a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java deleted file mode 100644 index a7b931be62..0000000000 --- a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.eventexecutor; - -import com.google.common.reflect.AbstractInvocationHandler; -import com.google.common.reflect.Reflection; -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.GlobalEventExecutor; -import io.netty.util.concurrent.ImmediateEventExecutor; -import java.lang.reflect.Method; -import java.util.concurrent.TimeUnit; - -public interface AutoCloseableEventExecutor extends EventExecutor, AutoCloseable { - static AutoCloseableEventExecutor globalEventExecutor() { - return createCloseableProxy(GlobalEventExecutor.INSTANCE); - } - - static AutoCloseableEventExecutor immediateEventExecutor() { - return createCloseableProxy(ImmediateEventExecutor.INSTANCE); - } - - private static AutoCloseableEventExecutor createCloseableProxy(final EventExecutor eventExecutor) { - return Reflection.newProxy(AutoCloseableEventExecutor.class, new AbstractInvocationHandler() { - @Override - protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) - throws Throwable { - if (method.getName().equals("close")) { - eventExecutor.shutdownGracefully(0, 1, TimeUnit.SECONDS); - return null; - } else { - return method.invoke(eventExecutor, args); - } - } - }); - } -} diff --git a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/OSGiGlobalEventExecutor.java b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/OSGiGlobalEventExecutor.java deleted file mode 100644 index 58697d8e23..0000000000 --- a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/OSGiGlobalEventExecutor.java +++ /dev/null @@ -1,202 +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.eventexecutor; - -import static io.netty.util.concurrent.GlobalEventExecutor.INSTANCE; - -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.EventExecutorGroup; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.ProgressivePromise; -import io.netty.util.concurrent.Promise; -import io.netty.util.concurrent.ScheduledFuture; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Deactivate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Component(immediate = true, property = "type=global-event-executor") -public final class OSGiGlobalEventExecutor implements EventExecutor { - private static final Logger LOG = LoggerFactory.getLogger(OSGiGlobalEventExecutor.class); - - @Override - public boolean isShuttingDown() { - return INSTANCE.isShuttingDown(); - } - - @Override - public Future shutdownGracefully() { - return INSTANCE.shutdownGracefully(); - } - - @Override - public Future shutdownGracefully(final long quietPeriod, final long timeout, final TimeUnit unit) { - return INSTANCE.shutdownGracefully(quietPeriod, timeout, unit); - } - - @Override - public Future terminationFuture() { - return INSTANCE.terminationFuture(); - } - - @Override - @Deprecated - public void shutdown() { - INSTANCE.shutdown(); - } - - @Override - public List shutdownNow() { - return INSTANCE.shutdownNow(); - } - - @Override - public Iterator iterator() { - return INSTANCE.iterator(); - } - - @Override - public Future submit(final Runnable task) { - return INSTANCE.submit(task); - } - - @Override - public Future submit(final Runnable task, final T result) { - return INSTANCE.submit(task, result); - } - - @Override - public Future submit(final Callable task) { - return INSTANCE.submit(task); - } - - @Override - public ScheduledFuture schedule(final Runnable command, final long delay, final TimeUnit unit) { - return INSTANCE.schedule(command, delay, unit); - } - - @Override - public ScheduledFuture schedule(final Callable callable, final long delay, final TimeUnit unit) { - return INSTANCE.schedule(callable, delay, unit); - } - - @Override - public ScheduledFuture scheduleAtFixedRate(final Runnable command, final long initialDelay, final long period, - final TimeUnit unit) { - return INSTANCE.scheduleAtFixedRate(command, initialDelay, period, unit); - } - - @Override - public ScheduledFuture scheduleWithFixedDelay(final Runnable command, final long initialDelay, final long delay, - final TimeUnit unit) { - return INSTANCE.scheduleWithFixedDelay(command, initialDelay, delay, unit); - } - - @Override - public boolean isShutdown() { - return INSTANCE.isShutdown(); - } - - @Override - public boolean isTerminated() { - return INSTANCE.isTerminated(); - } - - @Override - public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException { - return INSTANCE.awaitTermination(timeout, unit); - } - - @Override - public List> invokeAll(final Collection> tasks) - throws InterruptedException { - return INSTANCE.invokeAll(tasks); - } - - @Override - public List> invokeAll(final Collection> tasks, - final long timeout, final TimeUnit unit) throws InterruptedException { - return INSTANCE.invokeAll(tasks, timeout, unit); - } - - @Override - public T invokeAny(final Collection> tasks) - throws InterruptedException, ExecutionException { - return INSTANCE.invokeAny(tasks); - } - - @Override - public T invokeAny(final Collection> tasks, final long timeout, final TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return INSTANCE.invokeAny(tasks, timeout, unit); - } - - @Override - public void execute(final Runnable command) { - INSTANCE.execute(command); - } - - @Override - public EventExecutor next() { - return INSTANCE.next(); - } - - @Override - public EventExecutorGroup parent() { - return INSTANCE.parent(); - } - - @Override - public boolean inEventLoop() { - return INSTANCE.inEventLoop(); - } - - @Override - public boolean inEventLoop(final Thread thread) { - return INSTANCE.inEventLoop(thread); - } - - @Override - public Promise newPromise() { - return INSTANCE.newPromise(); - } - - @Override - public ProgressivePromise newProgressivePromise() { - return INSTANCE.newProgressivePromise(); - } - - @Override - public Future newSucceededFuture(final V result) { - return INSTANCE.newSucceededFuture(result); - } - - @Override - public Future newFailedFuture(final Throwable cause) { - return INSTANCE.newFailedFuture(cause); - } - - @Activate - void activate() { - LOG.info("Global Event executor enabled"); - } - - @Deactivate - void deactivate() { - LOG.info("Global Event executor disabled"); - } - -} diff --git a/opendaylight/config/netty-threadgroup-config/pom.xml b/opendaylight/config/netty-threadgroup-config/pom.xml deleted file mode 100644 index 7c1d9bcf0d..0000000000 --- a/opendaylight/config/netty-threadgroup-config/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - bundle-parent - 13.0.10 - - - - org.opendaylight.controller - netty-threadgroup-config - 0.20.0-SNAPSHOT - bundle - ${project.artifactId} - Configuration Wrapper around netty's event group - - - - io.netty - netty-common - - - io.netty - netty-transport - - - org.osgi - org.osgi.service.component.annotations - - - org.osgi - org.osgi.service.metatype.annotations - - - diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/AbstractGlobalGroup.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/AbstractGlobalGroup.java deleted file mode 100644 index ca4bc29283..0000000000 --- a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/AbstractGlobalGroup.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadgroup; - -import io.netty.channel.nio.NioEventLoopGroup; -import java.util.concurrent.TimeUnit; - -abstract class AbstractGlobalGroup extends NioEventLoopGroup implements AutoCloseable { - AbstractGlobalGroup(final int threadCount) { - super(threadCount < 0 ? 0 : threadCount); - } - - @Override - public final void close() { - shutdownGracefully(0, 1, TimeUnit.SECONDS); - } -} diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/Configuration.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/Configuration.java deleted file mode 100644 index 174b44fdf2..0000000000 --- a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/Configuration.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021 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.threadgroup; - -import org.osgi.service.metatype.annotations.AttributeDefinition; -import org.osgi.service.metatype.annotations.ObjectClassDefinition; - -@ObjectClassDefinition(pid = "org.opendaylight.netty.threadgroup") -public @interface Configuration { - @AttributeDefinition(name = "global-boss-group-thread-count") - int bossThreadCount() default 0; - - @AttributeDefinition(name = "global-worker-group-thread-count") - int workerThreadCount() default 0; -} diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalBossGroup.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalBossGroup.java deleted file mode 100644 index 5b461848e9..0000000000 --- a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalBossGroup.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2021 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.threadgroup; - -import io.netty.channel.EventLoopGroup; -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.Designate; - -@Component(immediate = true, service = EventLoopGroup.class, property = "type=global-boss-group") -@Designate(ocd = Configuration.class) -public final class GlobalBossGroup extends AbstractGlobalGroup { - @Activate - public GlobalBossGroup(final Configuration configuration) { - super(configuration.bossThreadCount()); - } - - @Deactivate - void deactivate() { - close(); - } -} diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalWorkerGroup.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalWorkerGroup.java deleted file mode 100644 index 4a9f46ed6b..0000000000 --- a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/GlobalWorkerGroup.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2021 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.threadgroup; - -import io.netty.channel.EventLoopGroup; -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.Designate; - -@Component(immediate = true, service = EventLoopGroup.class, property = "type=global-worker-group") -@Designate(ocd = Configuration.class) -public final class GlobalWorkerGroup extends AbstractGlobalGroup { - @Activate - public GlobalWorkerGroup(final Configuration configuration) { - super(configuration.workerThreadCount()); - } - - @Deactivate - void deactivate() { - close(); - } -} diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/package-info.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/package-info.java deleted file mode 100644 index f5b65ee83a..0000000000 --- a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2021 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 - */ -@org.osgi.service.component.annotations.RequireServiceComponentRuntime -package org.opendaylight.controller.config.yang.netty.threadgroup; \ No newline at end of file diff --git a/opendaylight/config/netty-timer-config/pom.xml b/opendaylight/config/netty-timer-config/pom.xml deleted file mode 100644 index b1cc6cd96e..0000000000 --- a/opendaylight/config/netty-timer-config/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - bundle-parent - 13.0.10 - - - - org.opendaylight.controller - netty-timer-config - 0.20.0-SNAPSHOT - bundle - ${project.artifactId} - Configuration Wrapper around netty's timer - - - - io.netty - netty-common - - - org.eclipse.jdt - org.eclipse.jdt.annotation - - - org.osgi - org.osgi.service.component.annotations - - - org.osgi - org.osgi.service.metatype.annotations - - - diff --git a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java deleted file mode 100644 index 7bc1352164..0000000000 --- a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.HashedWheelTimer; -import io.netty.util.Timeout; -import io.netty.util.Timer; -import io.netty.util.TimerTask; -import java.util.Set; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import org.eclipse.jdt.annotation.Nullable; - -public final class HashedWheelTimerCloseable implements AutoCloseable, Timer { - - private final Timer timer; - - private HashedWheelTimerCloseable(final Timer timer) { - this.timer = timer; - } - - @Override - public void close() { - stop(); - } - - @Override - public Timeout newTimeout(final TimerTask task, final long delay, final TimeUnit unit) { - return this.timer.newTimeout(task, delay, unit); - } - - @Override - public Set stop() { - return this.timer.stop(); - } - - public static HashedWheelTimerCloseable newInstance(final @Nullable Long duration, - final @Nullable Integer ticksPerWheel) { - return newInstance(null, duration, ticksPerWheel); - } - - public static HashedWheelTimerCloseable newInstance(final @Nullable ThreadFactory threadFactory, - final @Nullable Long duration, final @Nullable Integer ticksPerWheel) { - TimeUnit unit = TimeUnit.MILLISECONDS; - if (!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) { - return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit)); - } - - if (!nullOrNonPositive(duration) && threadFactory == null && !nullOrNonPositive(ticksPerWheel)) { - return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit, ticksPerWheel)); - } - - if (nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { - return new HashedWheelTimerCloseable(new HashedWheelTimer(threadFactory)); - } - - if (!nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { - return new HashedWheelTimerCloseable( - new HashedWheelTimer(threadFactory, duration, unit)); - } - - if (!nullOrNonPositive(duration) && threadFactory != null && !nullOrNonPositive(ticksPerWheel)) { - return new HashedWheelTimerCloseable( - new HashedWheelTimer(threadFactory, duration, unit, ticksPerWheel)); - } - - return new HashedWheelTimerCloseable(new HashedWheelTimer()); - } - - private static boolean nullOrNonPositive(final Number num) { - return num == null || num.longValue() <= 0; - } -} 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(); - } -} diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml deleted file mode 100644 index 1d9dffe570..0000000000 --- a/opendaylight/config/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - 4.0.0 - - org.opendaylight.odlparent - odlparent-lite - 13.0.10 - - - - org.opendaylight.controller - config-aggregator - 0.20.0-SNAPSHOT - pom - - - true - true - - - - threadpool-config-api - threadpool-config-impl - netty-threadgroup-config - netty-event-executor-config - netty-timer-config - - diff --git a/opendaylight/config/threadpool-config-api/pom.xml b/opendaylight/config/threadpool-config-api/pom.xml deleted file mode 100644 index a889ae9db1..0000000000 --- a/opendaylight/config/threadpool-config-api/pom.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - bundle-parent - 13.0.10 - - - - org.opendaylight.controller - threadpool-config-api - 0.20.0-SNAPSHOT - bundle - ${project.artifactId} - diff --git a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java deleted file mode 100644 index 79ed26b2d2..0000000000 --- a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool; - -import java.util.concurrent.ScheduledExecutorService; - -/** - * Interface representing scheduled {@link ThreadPool}. - */ -public interface ScheduledThreadPool extends ThreadPool { - - @Override - ScheduledExecutorService getExecutor(); -} \ No newline at end of file diff --git a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java deleted file mode 100644 index 68ecb80fe3..0000000000 --- a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool; - -import java.util.concurrent.ExecutorService; - -/** - * Interface representing thread pool. - */ -public interface ThreadPool { - - ExecutorService getExecutor(); - - int getMaxThreadCount(); -} \ No newline at end of file diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml deleted file mode 100644 index b261e14c06..0000000000 --- a/opendaylight/config/threadpool-config-impl/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - bundle-parent - 13.0.10 - - - - org.opendaylight.controller - threadpool-config-impl - 0.20.0-SNAPSHOT - bundle - ${project.artifactId} - - - - - org.opendaylight.controller - controller-artifacts - 9.0.0-SNAPSHOT - pom - import - - - - - - - ${project.groupId} - threadpool-config-api - - - com.google.guava - guava - - - diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java deleted file mode 100644 index 2dad26490b..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool.util; - -import java.io.Closeable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import org.opendaylight.controller.config.threadpool.ThreadPool; - -/** - * Implementation of {@link ThreadPool} using fixed number of threads wraps - * {@link ExecutorService}. - */ -public class FixedThreadPoolWrapper implements ThreadPool, Closeable { - - private final ThreadPoolExecutor executor; - - public FixedThreadPoolWrapper(int threadCount, ThreadFactory factory) { - this.executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount, factory); - executor.prestartAllCoreThreads(); - } - - @Override - public ExecutorService getExecutor() { - return Executors.unconfigurableExecutorService(executor); - } - - @Override - public void close() { - executor.shutdown(); - } - - @Override - public int getMaxThreadCount() { - return executor.getMaximumPoolSize(); - } - - public void setMaxThreadCount(int maxThreadCount) { - executor.setCorePoolSize(maxThreadCount); - executor.setMaximumPoolSize(maxThreadCount); - } -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java deleted file mode 100644 index 6fb1adcb69..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool.util; - -import java.io.Closeable; -import java.util.OptionalInt; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.RejectedExecutionHandler; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import org.opendaylight.controller.config.threadpool.ThreadPool; - -/** - * Implementation of {@link ThreadPool} using flexible number of threads wraps - * {@link ExecutorService}. - */ -public class FlexibleThreadPoolWrapper implements ThreadPool, Closeable { - private final ThreadPoolExecutor executor; - - public FlexibleThreadPoolWrapper(final int minThreadCount, final int maxThreadCount, final long keepAlive, - final TimeUnit timeUnit, final ThreadFactory threadFactory) { - this(minThreadCount, maxThreadCount, keepAlive, timeUnit, threadFactory, getQueue(OptionalInt.empty())); - } - - public FlexibleThreadPoolWrapper(final int minThreadCount, final int maxThreadCount, final long keepAlive, - final TimeUnit timeUnit, final ThreadFactory threadFactory, final OptionalInt queueCapacity) { - this(minThreadCount, maxThreadCount, keepAlive, timeUnit, threadFactory, getQueue(queueCapacity)); - } - - private FlexibleThreadPoolWrapper(final int minThreadCount, final int maxThreadCount, final long keepAlive, - final TimeUnit timeUnit, final ThreadFactory threadFactory, final BlockingQueue queue) { - - executor = new ThreadPoolExecutor(minThreadCount, maxThreadCount, keepAlive, timeUnit, - queue, threadFactory, new FlexibleRejectionHandler()); - executor.prestartAllCoreThreads(); - } - - /** - * Overriding the queue: - * ThreadPoolExecutor would not create new threads if the queue is not full, thus adding - * occurs in RejectedExecutionHandler. - * This impl saturates threadpool first, then queue. When both are full caller will get blocked. - */ - private static ForwardingBlockingQueue getQueue(final OptionalInt capacity) { - return new ForwardingBlockingQueue( - capacity.isPresent() ? new LinkedBlockingQueue<>(capacity.orElseThrow()) : new LinkedBlockingQueue<>()); - } - - @Override - public ExecutorService getExecutor() { - return Executors.unconfigurableExecutorService(executor); - } - - public int getMinThreadCount() { - return executor.getCorePoolSize(); - } - - public void setMinThreadCount(final int minThreadCount) { - executor.setCorePoolSize(minThreadCount); - } - - @Override - public int getMaxThreadCount() { - return executor.getMaximumPoolSize(); - } - - public void setMaxThreadCount(final int maxThreadCount) { - executor.setMaximumPoolSize(maxThreadCount); - } - - public long getKeepAliveMillis() { - return executor.getKeepAliveTime(TimeUnit.MILLISECONDS); - } - - public void setKeepAliveMillis(final long keepAliveMillis) { - executor.setKeepAliveTime(keepAliveMillis, TimeUnit.MILLISECONDS); - } - - public void setThreadFactory(final ThreadFactory threadFactory) { - executor.setThreadFactory(threadFactory); - } - - public void prestartAllCoreThreads() { - executor.prestartAllCoreThreads(); - } - - @Override - public void close() { - executor.shutdown(); - } - - /** - * if the max threads are met, then it will raise a rejectedExecution. We then push to the queue. - */ - private static final class FlexibleRejectionHandler implements RejectedExecutionHandler { - @Override - @SuppressWarnings("checkstyle:parameterName") - public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) { - try { - executor.getQueue().put(r); - } catch (InterruptedException e) { - throw new RejectedExecutionException("Interrupted while waiting on the queue", e); - } - } - } - - private static final class ForwardingBlockingQueue - extends com.google.common.util.concurrent.ForwardingBlockingQueue { - private final BlockingQueue delegate; - - ForwardingBlockingQueue(final BlockingQueue delegate) { - this.delegate = delegate; - } - - @Override - protected BlockingQueue delegate() { - return delegate; - } - - @Override - @SuppressWarnings("checkstyle:parameterName") - public boolean offer(final Runnable o) { - // ThreadPoolExecutor will spawn a new thread after core size is reached only - // if the queue.offer returns false. - return false; - } - } -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java deleted file mode 100644 index 0efa4824ae..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool.util; - -import static java.util.Objects.requireNonNull; - -import java.io.Closeable; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicLong; - -/** - * Implementation of {@link ThreadFactory}. This class is thread-safe. - */ -public class NamingThreadPoolFactory implements ThreadFactory, Closeable { - - private final ThreadGroup group; - private final String namePrefix; - private final AtomicLong threadName = new AtomicLong(); - - public NamingThreadPoolFactory(final String namePrefix) { - this.namePrefix = requireNonNull(namePrefix); - this.group = new ThreadGroup(namePrefix); - } - - @Override - @SuppressWarnings("checkstyle:parameterName") - public Thread newThread(final Runnable r) { - return new Thread(group, r, String.format("%s-%d", group.getName(), threadName.incrementAndGet())); - } - - @Override - public void close() { - } - - public String getNamePrefix() { - return namePrefix; - } -} diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java deleted file mode 100644 index 648bd82ab0..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. 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.threadpool.util; - -import java.io.Closeable; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; - -/** - * Implementation of {@link ScheduledThreadPool} wraps - * {@link ScheduledExecutorService}. - */ -public class ScheduledThreadPoolWrapper implements ScheduledThreadPool, Closeable { - - private final ScheduledThreadPoolExecutor executor; - private final int threadCount; - - public ScheduledThreadPoolWrapper(int threadCount, ThreadFactory factory) { - this.threadCount = threadCount; - this.executor = new ScheduledThreadPoolExecutor(threadCount, factory); - executor.prestartAllCoreThreads(); - } - - @Override - public ScheduledExecutorService getExecutor() { - return Executors.unconfigurableScheduledExecutorService(executor); - } - - @Override - public void close() { - executor.shutdown(); - } - - @Override - public int getMaxThreadCount() { - return threadCount; - } - -} diff --git a/pom.xml b/pom.xml index 341b3fe690..a05f2b9ef6 100644 --- a/pom.xml +++ b/pom.xml @@ -32,12 +32,8 @@ benchmark jolokia - - opendaylight/md-sal - - opendaylight/config - opendaylight/blueprint + opendaylight/md-sal -- 2.36.6