X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fcommon%2Fdevice%2FDeviceTransactionManager.java;h=1dbc128c9c274dc37b603ce7ced1a0df22cb31fa;hb=f5a8fe61d265bce36b2fca393d82685a22ac326a;hp=20371356f88f2652e39941dbf33aadc2ec19a4d6;hpb=f8f1b05b6eefd0f5c18e22c22b4d4e023f61faf6;p=transportpce.git diff --git a/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransactionManager.java b/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransactionManager.java index 20371356f..1dbc128c9 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransactionManager.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/device/DeviceTransactionManager.java @@ -11,9 +11,8 @@ package org.opendaylight.transportpce.common.device; import java.util.Optional; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; - -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.mdsal.binding.api.MountPoint; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -41,7 +40,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; *
*- * Bellow is simple example how to get {@link DeviceTransaction}, put some data to it and then submit it. + * Bellow is simple example how to get {@link DeviceTransaction}, put some data to it and then commit it. + *
** {@code * // get device transaction future from device transaction manager @@ -93,24 +93,23 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; * deviceTx.put(LogicalDatastoreType.CONFIGURATION, someInstanceIdentifier, someData); * deviceTx.delete(LogicalDatastoreType.CONFIGURATION, someOtherInstanceIdentifier, someOtherData); * - * // submit transaction with 5 seconds timeout - * ListenableFuture- * */ public interface DeviceTransactionManager { /** * Gets Future containing {@link DeviceTransaction}. Since only one transaction can be opened per device future will - * return transaction when all previously submitted transaction on device are closed. This method will use default - * timeout for submit transaction. + * return transaction when all previously committed transaction on device are closed. This method will use default + * timeout for commit transaction. * * @param deviceId device identifier on which will be transaction created. * @return Future returning Optional of DeviceTransaction. Optional will be empty if device with specified ID @@ -123,7 +122,7 @@ public interface DeviceTransactionManager { * * @param deviceId device id on which will be transaction created. * @param timeoutToSubmit timeout will start running when transaction is created. If transaction will not be - * closed (submitted or cancelled) when times runs out it will be canceled (so device will + * closed (committed or cancelled) when times runs out it will be canceled (so device will * be unlocked). * @param timeUnit time units for timeout. * @return Future returning Optional of DeviceTransaction. Optional will be empty if device with specified ID @@ -132,14 +131,15 @@ public interface DeviceTransactionManager { Futuresubmit = deviceTx.submit(5, TimeUnit.SECONDS); + * // commit transaction with 5 seconds timeout + * FluentFuture extends @NonNull CommitInfo> commit = deviceTx.commit(5, TimeUnit.SECONDS); * try { - * // wait until transaction is submitted - * submit.get(); + * // wait until transaction is committed + * commit.get(); * } catch (InterruptedException | ExecutionException e) { * throw new IllegalStateException("Failed to post data to device " + deviceId + "!", e); * } * } *
* This method is blocking - it's waiting until it receives {@link DeviceTransaction} and then the data from device. + *
* * @param deviceId Device identifier from which will be data read. * @param logicalDatastoreType Datastore type.