Do not use ListeningExecutorService 08/106808/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 4 Jul 2023 19:09:06 +0000 (21:09 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 5 Jul 2023 15:20:12 +0000 (17:20 +0200)
We ignore return from submit() -- hence we can just use execute()
instead. Also drop a FIXME to terminate the ExecutorService, as it seems
to be just hanging.

Change-Id: I395e31bbaab8ad41d56e8a9a89839682af42127a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
graph/graph-impl/src/main/java/org/opendaylight/graph/impl/ConnectedGraphImpl.java

index ab8ca79478bd3056ae917c6344b2cb51908be625..d38ee660362d103fb8fc46a991d15c5955af9c59 100644 (file)
@@ -9,13 +9,12 @@ package org.opendaylight.graph.impl;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.graph.ConnectedEdge;
@@ -62,7 +61,8 @@ public class ConnectedGraphImpl implements ConnectedGraph {
 
     /* List of Triggers attached to the Connected Graph */
     private final ConcurrentHashMap<TopologyKey, ConnectedGraphTrigger> graphTriggers = new ConcurrentHashMap<>();
-    private final ListeningExecutorService exec = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
+    // FIXME: this service is never shut down
+    private final ExecutorService exec = Executors.newCachedThreadPool();
 
     /* Reference to the non connected Graph stored in DataStore */
     private Graph graph;
@@ -255,7 +255,7 @@ public class ConnectedGraphImpl implements ConnectedGraph {
             return;
         }
         for (ConnectedGraphTrigger trigger : graphTriggers.values()) {
-            exec.submit(() -> trigger.verifyVertex(vertexTriggers, cvertex, vertex));
+            exec.execute(() -> trigger.verifyVertex(vertexTriggers, cvertex, vertex));
         }
     }
 
@@ -291,7 +291,7 @@ public class ConnectedGraphImpl implements ConnectedGraph {
             return;
         }
         for (ConnectedGraphTrigger trigger : graphTriggers.values()) {
-            exec.submit(() -> trigger.verifyEdge(edgeTriggers, cedge, edge));
+            exec.execute(() -> trigger.verifyEdge(edgeTriggers, cedge, edge));
         }
     }