remove apparently un-used methods in AbstractTranscriberInterface 50/73250/2
authorMichael Vorburger <vorburger@redhat.com>
Wed, 20 Jun 2018 12:27:56 +0000 (14:27 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Mon, 25 Jun 2018 13:43:30 +0000 (13:43 +0000)
These methods seems left overs; they have functionality comparable to
other existing methods which are actually used, but these do not have
the dependency checks hooks I've added; so just remove them:

* addMd()
* updateMd()
* removeMd()

JIRA: NEUTRON-158
Change-Id: If53bb7bce6c9cfcc2bd9fa640de3fd11e76c6513
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
transcriber/src/main/java/org/opendaylight/neutron/transcriber/AbstractTranscriberInterface.java

index 7ac1ba3c1a0f43b0de41aebe265358e82a8cb4b3..987d4781682cc1b4a08e09f42c3c84adef687523 100644 (file)
@@ -343,17 +343,6 @@ public abstract class AbstractTranscriberInterface<
         updateMd(neutronObject, tx);
     }
 
-    protected boolean addMd(S neutronObject) {
-        try {
-            final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
-            addMd(neutronObject, tx);
-            return true;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("Transaction failed", e);
-        }
-        return false;
-    }
-
     private void updateMd(S neutronObject, WriteTransaction tx) throws InterruptedException, ExecutionException {
         Preconditions.checkNotNull(tx);
 
@@ -365,26 +354,6 @@ public abstract class AbstractTranscriberInterface<
         future.get();
     }
 
-    protected boolean updateMd(S neutronObject) {
-        int retries = RETRY_MAX;
-        while (retries-- >= 0) {
-            try {
-                final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
-                updateMd(neutronObject, tx);
-                return true;
-            } catch (InterruptedException | ExecutionException e) {
-                if (e.getCause() instanceof OptimisticLockFailedException) {
-                    LOG.warn("Got OptimisticLockFailedException - {} {}", neutronObject, retries);
-                    continue;
-                }
-                // TODO: rethrow exception. don't mask exception
-                LOG.error("Transaction failed", e);
-            }
-            break;
-        }
-        return false;
-    }
-
     private void removeMd(T item, WriteTransaction tx) throws InterruptedException, ExecutionException {
         Preconditions.checkNotNull(tx);
         final InstanceIdentifier<T> iid = createInstanceIdentifier(item);
@@ -394,17 +363,6 @@ public abstract class AbstractTranscriberInterface<
         future.get();
     }
 
-    protected boolean removeMd(T item) {
-        final ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction();
-        try {
-            removeMd(item, tx);
-            return true;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("Transaction failed", e);
-        }
-        return false;
-    }
-
     protected static Uuid toUuid(String uuid) {
         Preconditions.checkNotNull(uuid, "uuid");
         Uuid result;