remove DeviceTransaction.submit()
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / device / DeviceTransaction.java
index 3ee2964ce641e8398aaf9ca122bf5c138864402c..810a3ed1f80f8048449e5f8cef359d1aa0232ae4 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.transportpce.common.device;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
@@ -99,43 +98,13 @@ public class DeviceTransaction {
     }
 
     /**
-     * Submits data changed in transaction to device with defined timeout to submit. If time from timeout runs out then
-     * submit will be interrupted and device will be unlocked.
+     * Submits data changed in transaction to device with defined timeout to commit. If time from timeout runs out then
+     * the commit will be interrupted and the device will be unlocked.
      *
      * @param timeout a timeout
      * @param timeUnit a time unit
-     * @return ListenableFuture which indicates when is submit completed.
+     * @return FluentFuture which indicates when the commit is completed.
      */
-    @Deprecated
-    public ListenableFuture<Void> submit(long timeout, TimeUnit timeUnit) {
-        if (wasSubmittedOrCancelled.get()) {
-            String msg = "Transaction was already submitted or canceled!";
-            LOG.error(msg);
-            return Futures.immediateFailedFuture(new IllegalStateException(msg));
-        }
-
-        LOG.debug("Transaction submitted. Lock: {}", deviceLock);
-        wasSubmittedOrCancelled.set(true);
-        ListenableFuture<Void> future =
-                Futures.withTimeout(rwTx.submit(), timeout, timeUnit, scheduledExecutorService);
-
-        Futures.addCallback(future, new FutureCallback<Void>() {
-            @Override
-            public void onSuccess(@Nullable Void result) {
-                LOG.debug("Transaction with lock {} successfully submitted.", deviceLock);
-                afterClose();
-            }
-
-            @Override
-            public void onFailure(Throwable throwable) {
-                LOG.error("Device transaction submit failed or submit took longer than {} {}! Unlocking device.",
-                    timeout, timeUnit, throwable);
-                afterClose();
-            }
-        }, scheduledExecutorService);
-        return future;
-    }
-
     public FluentFuture<? extends @NonNull CommitInfo> commit(long timeout, TimeUnit timeUnit) {
         if (wasSubmittedOrCancelled.get()) {
             String msg = "Transaction was already submitted or canceled!";