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>