/* * 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 */ /** * Generated file * Generated from: yang module name: config-programming-impl yang module local name: instruction-scheduler-impl * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator * Generated at: Mon Nov 18 16:50:17 CET 2013 * * Do not modify this file unless it is present under src/main directory */ package org.opendaylight.controller.config.yang.programming.impl; import java.util.concurrent.Executors; import org.opendaylight.bgpcep.programming.impl.ProgrammingServiceImpl; import org.opendaylight.bgpcep.programming.spi.Instruction; import org.opendaylight.bgpcep.programming.spi.InstructionScheduler; import org.opendaylight.bgpcep.programming.spi.SchedulerException; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.ProgrammingService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.SubmitInstructionInput; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; /** * */ public final class InstructionSchedulerImplModule extends org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerImplModule { public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final InstructionSchedulerImplModule oldModule, final java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @Override protected void customValidation() { // Add custom validation for module attributes here. } @Override public java.lang.AutoCloseable createInstance() { final ListeningExecutorService exec = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); final ProgrammingServiceImpl inst = new ProgrammingServiceImpl(getDataProviderDependency(), getNotificationServiceDependency(), exec, getTimerDependency()); final RpcRegistration reg = getRpcRegistryDependency().addRpcImplementation(ProgrammingService.class, inst); final class ProgrammingServiceImplCloseable implements InstructionScheduler, AutoCloseable { @Override public void close() throws Exception { try { reg.close(); } finally { try { inst.close(); } finally { exec.shutdown(); } } } @Override public ListenableFuture scheduleInstruction(final SubmitInstructionInput input) throws SchedulerException { return inst.scheduleInstruction(input); } } return new ProgrammingServiceImplCloseable(); } }