da0639187d0cd7b7569f93b1b5f6416384de9108
[controller.git] / opendaylight / config / netty-event-executor-config / src / main / java / org / opendaylight / controller / config / yang / netty / eventexecutor / GlobalEventExecutorModule.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 /**
10  * Generated file
11
12  * Generated from: yang module name: netty-event-executor  yang module local name: netty-global-event-executor
13  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
14  * Generated at: Tue Nov 12 10:44:21 CET 2013
15  *
16  * Do not modify this file unless it is present under src/main directory
17  */
18 package org.opendaylight.controller.config.yang.netty.eventexecutor;
19
20 import io.netty.util.concurrent.EventExecutor;
21 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
22 import org.opendaylight.controller.config.yang.netty.eventexecutor.AutoCloseableEventExecutor.CloseableEventExecutorMixin;
23 import org.osgi.framework.BundleContext;
24
25 public final class GlobalEventExecutorModule extends
26         org.opendaylight.controller.config.yang.netty.eventexecutor.AbstractGlobalEventExecutorModule {
27     private BundleContext bundleContext;
28
29     public GlobalEventExecutorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
30             org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
31         super(identifier, dependencyResolver);
32     }
33
34     public GlobalEventExecutorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
35             org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
36             GlobalEventExecutorModule oldModule, java.lang.AutoCloseable oldInstance) {
37         super(identifier, dependencyResolver, oldModule, oldInstance);
38     }
39
40     @Override
41     public void validate() {
42         super.validate();
43     }
44
45     @Override
46     public AutoCloseable createInstance() {
47         // The service is provided via blueprint so wait for and return it here for backwards compatibility.
48         final WaitingServiceTracker<EventExecutor> tracker = WaitingServiceTracker.create(
49                 EventExecutor.class, bundleContext, "(type=global-event-executor)");
50         EventExecutor eventExecutor = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
51         return CloseableEventExecutorMixin.forwardingEventExecutor(eventExecutor, tracker);
52     }
53
54     public void setBundleContext(final BundleContext bundleContext) {
55         this.bundleContext = bundleContext;
56     }
57 }