Change ClusterSingletonServiceService.closeServiceInstance() 63/72163/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 22 May 2018 13:50:23 +0000 (15:50 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 22 May 2018 13:52:02 +0000 (15:52 +0200)
Requiring ListenableFuture<Void> is overly restrictive, we should
allow implementations to give us whatever future they have -- all
we care about is their completion.

JIRA: MDSAL-340
Change-Id: Ic61c3731b7be53d45ea9a9bdb8dd9786f20ee111
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
singleton-service/mdsal-singleton-common-api/src/main/java/org/opendaylight/mdsal/singleton/common/api/ClusterSingletonService.java
singleton-service/mdsal-singleton-dom-impl/src/main/java/org/opendaylight/mdsal/singleton/dom/impl/ClusterSingletonServiceGroupImpl.java

index 2329f8be575a86664fbfe318f4e78eced31c047d..cd4cdca1496f71a1783a15fddcb0328a131986cd 100644 (file)
@@ -32,6 +32,6 @@ public interface ClusterSingletonService extends Identifiable<ServiceGroupIdenti
      *
      * @return a ListenableFuture that is completed when the underlying instance close operation is complete.
      */
-    ListenableFuture<Void> closeServiceInstance();
+    ListenableFuture<? extends Object> closeServiceInstance();
 
 }
index 877acbba4e7d73f222a51515ab3d38632d8d7751..5fc180208c2bed4222937a5bbb9afae36ef3d012 100644 (file)
@@ -661,9 +661,9 @@ final class ClusterSingletonServiceGroupImpl<P extends Path<P>, E extends Generi
             case STARTED:
                 localServicesState = ServiceState.STOPPING;
 
-                final List<ListenableFuture<Void>> serviceCloseFutureList = new ArrayList<>(serviceGroup.size());
+                final List<ListenableFuture<?>> serviceCloseFutureList = new ArrayList<>(serviceGroup.size());
                 for (final ClusterSingletonService service : serviceGroup) {
-                    final ListenableFuture<Void> future;
+                    final ListenableFuture<?> future;
 
                     try {
                         future = service.closeServiceInstance();
@@ -678,7 +678,7 @@ final class ClusterSingletonServiceGroupImpl<P extends Path<P>, E extends Generi
 
                 LOG.debug("Service group {} initiated service shutdown", identifier);
 
-                Futures.addCallback(Futures.allAsList(serviceCloseFutureList), new FutureCallback<List<Void>>() {
+                Futures.addCallback(Futures.allAsList(serviceCloseFutureList), new FutureCallback<List<?>>() {
                     @Override
                     public void onFailure(final Throwable cause) {
                         LOG.warn("Service group {} service stopping reported error", identifier, cause);
@@ -686,7 +686,7 @@ final class ClusterSingletonServiceGroupImpl<P extends Path<P>, E extends Generi
                     }
 
                     @Override
-                    public void onSuccess(final List<Void> nulls) {
+                    public void onSuccess(final List<?> nulls) {
                         onServicesStopped();
                     }
                 }, MoreExecutors.directExecutor());