Bug 2318: Follow-up changes for previous patch 12535 82/12582/4
authortpantelis <tpanteli@brocade.com>
Sat, 1 Nov 2014 22:17:33 +0000 (18:17 -0400)
committertpantelis <tpanteli@brocade.com>
Sun, 2 Nov 2014 11:51:07 +0000 (06:51 -0500)
commit71a3de6870f23f45b8246a0a476202ebfa9e9ea8
tree5774e9d5682b07184e835c2daaa2d179b51b3fb5
parentd7ce37f576bcf35aa29665db89cadf854487f338
Bug 2318: Follow-up changes for previous patch 12535

Addressed some comments and other minor changes as a follow-up to patch 12535.

Enhanced the comments in TransactionChainProxy.

Modified Shard to send a failure reply if an runtime exception occurs in
createTransaction. This allows the error to be propagated to the caller
instead of being thrown back to akka.

Modified TransactionChainProxy to throw an IllegalStateException if the
next chain Tx is created before the previous one is readied. Prior, the
Shard would throw an IllegalStateException but from the Future returned
from submit and not on new*Transaction as the API docs state. So this make
it consistent with API contract. This was implemented by introducing a
volatile State field with implemnetations, Idle, Allocated and Closed.

Also, modified TransactionChainProxy to throw TransactionChainClosedException
if the chain is already closed when on Tx create. Again. this makes it
consistent with the API docs.

Added unit tests in DistributedDataStoreIntegrationTest to verify failure
in both cases.

Change-Id: I1b1ed06ceb1d4599f3f6c5443ca24ac1441ac38f
Signed-off-by: tpantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockDataChangeListener.java