From: Milos Fabian Date: Tue, 5 Nov 2013 13:42:30 +0000 (+0100) Subject: Threadpool APIs and thread-related configuration service interfaces. X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~476 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=c79012eccfde22515037e04b10b594e1adee5315 Threadpool APIs and thread-related configuration service interfaces. EventBusServiceInterface - Service representing an event bus. The service acts as message router between event producers and event consumers. ScheduledThredPoolServiceInterface - An extension of the simple pool of threads able to schedule work to be executed at some point in time. ThreadFactoryServiceInterface - Service representing a ThreadFactory instance. It is directly useful in Java world, where various library pieces need to create threads and you may want to inject a customized thread implementation. ThreadPoolServiceInterface - Representing a simple pool of threads able to execute work. Change-Id: I4bb9c3fb118f317816ee24c7edaa292f8780ae32 Signed-off-by: Milos Fabian --- diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml index 62b9ec34d0..b3f2fcdabc 100755 --- a/opendaylight/config/pom.xml +++ b/opendaylight/config/pom.xml @@ -29,6 +29,7 @@ yang-store-impl yang-test logback-config + threadpool-config-api diff --git a/opendaylight/config/threadpool-config-api/pom.xml b/opendaylight/config/threadpool-config-api/pom.xml new file mode 100644 index 0000000000..b991b69213 --- /dev/null +++ b/opendaylight/config/threadpool-config-api/pom.xml @@ -0,0 +1,51 @@ + + + org.opendaylight.controller + config-subsystem + 0.2.2-SNAPSHOT + + 4.0.0 + threadpool-config-api + ${project.artifactId} + bundle + + 3.0.4 + + + + + org.opendaylight.controller + config-api + + + com.google.guava + guava + + + + + + + org.apache.felix + maven-bundle-plugin + + + + org.opendaylight.controller.config.api.*, + com.google.common.eventbus, + + + org.opendaylight.controller.config.threadpool, + org.opendaylight.controller.config.yang.threadpool + + + + + + org.opendaylight.yangtools + yang-maven-plugin + + + + \ No newline at end of file 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 new file mode 100644 index 0000000000..bf6c016d35 --- /dev/null +++ b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java @@ -0,0 +1,20 @@ +/* + * 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 + public 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 new file mode 100644 index 0000000000..701b0bcdf8 --- /dev/null +++ b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java @@ -0,0 +1,21 @@ +/* + * 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 { + + public ExecutorService getExecutor(); + + public int getMaxThreadCount(); +} \ No newline at end of file diff --git a/opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang b/opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang new file mode 100644 index 0000000000..14a20fdebc --- /dev/null +++ b/opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang @@ -0,0 +1,77 @@ +// vi: set smarttab et sw=4 tabstop=4: +module threadpool { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool"; + prefix "th"; + + import config { prefix config; revision-date 2013-04-05; } + + organization "Cisco Systems, Inc."; + + contact "Robert Varga "; + + description + "This module contains the base YANG definitions for + thread-related services. + + Copyright (c)2013 Cisco Systems, Inc. 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"; + + revision "2013-04-09" { + description + "Added eventbus service."; + } + + revision "2013-04-05" { + description + "Updated with YANG extension for Java class specification."; + } + + revision "2013-04-03" { + description + "Initial revision by Anton Tkacik, Tomas Olvecky and + Robert Varga."; + } + + identity eventbus { + description + "Service representing an event bus. The service acts as message + router between event producers and event consumers"; + + base "config:service-type"; + config:java-class "com.google.common.eventbus.EventBus"; + } + + identity threadfactory { + description + "Service representing a ThreadFactory instance. It is directly + useful in Java world, where various library pieces need to create + threads and you may want to inject a customized thread + implementation."; + + base "config:service-type"; + config:java-class "java.util.concurrent.ThreadFactory"; + } + + identity threadpool { + description + "A simple pool of threads able to execute work."; + + base "config:service-type"; + config:java-class "org.opendaylight.controller.config.threadpool.ThreadPool"; + } + + identity scheduled-threadpool { + description + "An extension of the simple pool of threads able to schedule + work to be executed at some point in time."; + + base "threadpool"; + config:java-class "org.opendaylight.controller.config.threadpool.ScheduledThreadPool"; + } + +}