Code Review
/
transportpce.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Remove common module deprecated methods
[transportpce.git]
/
common
/
src
/
main
/
java
/
org
/
opendaylight
/
transportpce
/
common
/
device
/
DeviceTransaction.java
diff --git
a/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransaction.java
b/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransaction.java
index 5aa093fd89b71420f5f0faeb7a21e7b2c29ba385..574dd6fddeeec6a1f556bf7e8b4aa1cd4f3dc92a 100644
(file)
--- a/
common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransaction.java
+++ b/
common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransaction.java
@@
-8,20
+8,20
@@
package org.opendaylight.transportpce.common.device;
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.FutureCallback;
-import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFuture;
-
+import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.annotation.Nullable;
-
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yangtools.util.concurrent.FluentFutures;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
@@
-62,19
+62,10
@@
public class DeviceTransaction {
rwTx.put(store, path, data);
}
rwTx.put(store, path, data);
}
- public <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
- boolean createMissingParents) {
- rwTx.put(store, path, data, createMissingParents);
- }
-
public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data) {
rwTx.merge(store, path, data);
}
public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data) {
rwTx.merge(store, path, data);
}
- public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
- boolean createMissingParents) {
- rwTx.merge(store, path, data, createMissingParents);
- }
public void delete(LogicalDatastoreType store, InstanceIdentifier<?> path) {
rwTx.delete(store, path);
public void delete(LogicalDatastoreType store, InstanceIdentifier<?> path) {
rwTx.delete(store, path);
@@
-97,36
+88,35
@@
public class DeviceTransaction {
}
/**
}
/**
- * Submits data changed in transaction to device with defined timeout to
sub
mit. 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
com
mit. 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
*
* @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) {
+ public FluentFuture<? extends @NonNull CommitInfo> commit(long timeout, TimeUnit timeUnit) {
if (wasSubmittedOrCancelled.get()) {
String msg = "Transaction was already submitted or canceled!";
LOG.error(msg);
if (wasSubmittedOrCancelled.get()) {
String msg = "Transaction was already submitted or canceled!";
LOG.error(msg);
- return F
utures.immediateFailed
Future(new IllegalStateException(msg));
+ return F
luentFutures.immediateFailedFluent
Future(new IllegalStateException(msg));
}
}
- LOG.debug("Transaction
sub
mitted. Lock: {}", deviceLock);
+ LOG.debug("Transaction
com
mitted. Lock: {}", deviceLock);
wasSubmittedOrCancelled.set(true);
wasSubmittedOrCancelled.set(true);
-
ListenableFuture<Void
> future =
-
Futures.withTimeout(rwTx.submit(),
timeout, timeUnit, scheduledExecutorService);
+
FluentFuture<? extends @NonNull CommitInfo
> future =
+
rwTx.commit().withTimeout(
timeout, timeUnit, scheduledExecutorService);
-
Futures.addCallback(future, new FutureCallback<Void
>() {
+
future.addCallback(new FutureCallback<CommitInfo
>() {
@Override
@Override
- public void onSuccess(
@Nullable Void
result) {
- LOG.debug("Transaction with lock {} successfully
submitted.", deviceLock
);
+ public void onSuccess(
CommitInfo
result) {
+ LOG.debug("Transaction with lock {} successfully
committed: {}", deviceLock, result
);
afterClose();
}
@Override
public void onFailure(Throwable throwable) {
afterClose();
}
@Override
public void onFailure(Throwable throwable) {
- LOG.error("Device transaction
sub
mit failed or submit took longer than {} {}! Unlocking device.",
+ LOG.error("Device transaction
com
mit failed or submit took longer than {} {}! Unlocking device.",
timeout, timeUnit, throwable);
afterClose();
}
timeout, timeUnit, throwable);
afterClose();
}