import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.checkerframework.checker.lock.qual.GuardedBy;
import org.checkerframework.checker.lock.qual.Holding;
import org.eclipse.jdt.annotation.Nullable;
LOG.info("PCEP Topology Deployer closed");
}
- @SuppressWarnings("checkstyle:IllegalCatch")
private static void closeTopology(final PCEPTopologyProviderBean topology, final TopologyId topologyId) {
if (topology == null) {
return;
LOG.info("Removing Topology {}", topologyId);
try {
topology.closeServiceInstance().get(TIMEOUT_NS, TimeUnit.NANOSECONDS);
- topology.close();
- } catch (final Exception e) {
+ } catch (final InterruptedException | TimeoutException | ExecutionException e) {
LOG.error("Topology {} instance failed to close service instance", topologyId, e);
}
+ topology.close();
}
private static boolean filterPcepTopologies(final @Nullable TopologyTypes topologyTypes) {
}
@Override
- public synchronized void close() throws Exception {
+ public synchronized void close() {
if (pcepTopoProviderCSS != null) {
pcepTopoProviderCSS.close();
pcepTopoProviderCSS = null;
cssRegistration = cssp.registerClusterSingletonService(this);
}
- @SuppressModernizer
- private static Dictionary<String, String> props(final PCEPTopologyConfiguration configDependencies) {
- final Dictionary<String, String> properties = new Hashtable<>();
- properties.put(PCEPTopologyProvider.class.getName(), configDependencies.getTopologyId().getValue());
- return properties;
- }
-
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public synchronized void instantiateServiceInstance() {
}
@Override
- public synchronized void close() throws Exception {
+ public synchronized void close() {
if (cssRegistration != null) {
cssRegistration.close();
cssRegistration = null;
}
scheduler.close();
}
+
+ @SuppressModernizer
+ private static Dictionary<String, String> props(final PCEPTopologyConfiguration configDependencies) {
+ final Dictionary<String, String> properties = new Hashtable<>();
+ properties.put(PCEPTopologyProvider.class.getName(), configDependencies.getTopologyId().getValue());
+ return properties;
+ }
}
\ No newline at end of file
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput;
import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.Registration;
-public interface InstructionScheduler extends Identifiable<ServiceGroupIdentifier>, AutoCloseable {
+public interface InstructionScheduler extends Identifiable<ServiceGroupIdentifier>, Registration {
/**
* Schedule a new instruction for execution. This method tries to enqueue an instruction. It will return a Future
* which represents the scheduling progress. When the future becomes successful, the requestor is expected to start
* 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.bgpcep.programming.spi;
/**
/**
* Creates a unique InstructionScheduler.
*
- * @param instructionId Unique Identifier, also to be used as part of
- * Cluster Singleton Service Group Identifier
+ * @param instructionId Unique Identifier, also to be used as part of Cluster Singleton Service Group Identifier
* as "instructionId"-service-group
* @return InstructionScheduler
*/
+ // FIXME: this has weird lifecycle implications. We really should be exposing some sort of an ObjectRegistration
+ // object, which exposes the SGI and allows unregistration, so that InstructionScheduler itself is in no way
+ // tied to its lifecycle and/or Cluster Singleton Service
InstructionScheduler createInstructionScheduler(String instructionId);
}