Fix modernization issues
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / provider / src / main / java / org / opendaylight / controller / clustering / it / provider / impl / PrefixShardHandler.java
index efc64a9ab630af9e3c9de701790daa5867df17e4..be35234ce0e7552c343b10fb74191320483acdd8 100644 (file)
@@ -5,7 +5,6 @@
  * 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.controller.clustering.it.provider.impl;
 
 import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ID;
@@ -23,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CompletionStage;
 import java.util.stream.Collectors;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.sharding.DistributedShardFactory;
 import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration;
@@ -94,10 +92,10 @@ public class PrefixShardHandler {
                 LOG.debug("Shard[{}] created successfully.", identifier);
                 registrations.put(identifier, registration);
 
-                final ListenableFuture<Void> ensureFuture = ensureListExists();
-                Futures.addCallback(ensureFuture, new FutureCallback<Void>() {
+                final ListenableFuture<?> ensureFuture = ensureListExists();
+                Futures.addCallback(ensureFuture, new FutureCallback<Object>() {
                     @Override
-                    public void onSuccess(@Nullable final Void result) {
+                    public void onSuccess(final Object result) {
                         LOG.debug("Initial list write successful.");
                         future.set(RpcResultBuilder.success(new CreatePrefixShardOutputBuilder().build()).build());
                     }
@@ -160,7 +158,7 @@ public class PrefixShardHandler {
         return future;
     }
 
-    private ListenableFuture<Void> ensureListExists() {
+    private ListenableFuture<?> ensureListExists() {
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = ImmutableNodes.mapNodeBuilder(ID_INT);
 
@@ -190,10 +188,10 @@ public class PrefixShardHandler {
         cursor.merge(containerNode.getIdentifier(), containerNode);
         cursor.close();
 
-        final ListenableFuture<Void> future = tx.submit();
-        Futures.addCallback(future, new FutureCallback<Void>() {
+        final ListenableFuture<?> future = tx.commit();
+        Futures.addCallback(future, new FutureCallback<Object>() {
             @Override
-            public void onSuccess(@Nullable final Void result) {
+            public void onSuccess(final Object result) {
                 try {
                     LOG.debug("Closing producer for initial list.");
                     producer.close();