I assume you mean:

Future *f* = t1.submit();
Futures.addCallback(*f*, new Callback{
AsyncReadTransaction t2 = broker.newReadOnlyTransaction();
Optional<?> maybeData = t2.read(id).get();
}

yes that would accomplish the result that the TransactionChain provides.
But with TransactionChain, you don't have to wait for the write to be
committed - you can read it immediately after submitting. Also makes the
code simpler.

On Thu, Sep 15, 2016 at 6:27 AM, Sela, Guy <guy.s...@hpe.com> wrote:

> Does this entity exist only to solve the problem in the javadoc?
>
>
>
> “
>
> AsyncWriteTransaction t1 = broker.newWriteOnlyTransaction();
>
> t1.put(id, data);
>
> t1.submit();
>
>
>
> AsyncReadTransaction t2 = broker.newReadOnlyTransaction();
>
> Optional<?> maybeData = t2.read(id).get();
>
> “
>
>
>
>
>
> Can’t it be solved with this code? (Pseudo code)
>
>
>
> AsyncWriteTransaction t1 = broker.newWriteOnlyTransaction();
>
> t1.put(id, data);
>
> *Future f = *t1.submit();
>
> *Futures.addCallback(new Callback{*
>
> AsyncReadTransaction t2 = broker.newReadOnlyTransaction();
>
> Optional<?> maybeData = t2.read(id).get();
>
> *}*
>
>
>
>
>
>
>
>
>
>
>
> Thanks,
>
> Guy Sela
>
>
>
> _______________________________________________
> controller-dev mailing list
> controller-dev@lists.opendaylight.org
> https://lists.opendaylight.org/mailman/listinfo/controller-dev
>
>
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to