summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
684c48a)
Patch https://git.opendaylight.org/gerrit/#/c/18392/ was merged with
some minor comments. This follow-up patch addresses them.
Change-Id: I1842a85f35021b598e1ded0b334453fd7751d9f7
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
}
private void handleBatchedModifications(BatchedModifications batched) {
}
private void handleBatchedModifications(BatchedModifications batched) {
- // This message is sent to prepare the modificationsa transaction directly on the Shard as an
+ // This message is sent to prepare the modifications transaction directly on the Shard as an
// optimization to avoid the extra overhead of a separate ShardTransaction actor. On the last
// BatchedModifications message, the caller sets the ready flag in the message indicating
// modifications are complete. The reply contains the cohort actor path (this actor) for the caller
// optimization to avoid the extra overhead of a separate ShardTransaction actor. On the last
// BatchedModifications message, the caller sets the ready flag in the message indicating
// modifications are complete. The reply contains the cohort actor path (this actor) for the caller
*
* @author Thomas Pantelis
*/
*
* @author Thomas Pantelis
*/
-public class ShardCommitCoordinator {
+class ShardCommitCoordinator {
// Interface hook for unit tests to replace or decorate the DOMStoreThreePhaseCommitCohorts.
public interface CohortDecorator {
// Interface hook for unit tests to replace or decorate the DOMStoreThreePhaseCommitCohorts.
public interface CohortDecorator {
private ReadyTransactionReply readyTransactionReply;
private ReadyTransactionReply readyTransactionReply;
- public ShardCommitCoordinator(ShardDataTree dataTree,
+ ShardCommitCoordinator(ShardDataTree dataTree,
long cacheExpiryTimeoutInMillis, int queueCapacity, ActorRef shardActor, Logger log, String name) {
this.queueCapacity = queueCapacity;
long cacheExpiryTimeoutInMillis, int queueCapacity, ActorRef shardActor, Logger log, String name) {
this.queueCapacity = queueCapacity;
this.cacheExpiryTimeoutInMillis = cacheExpiryTimeoutInMillis;
}
this.cacheExpiryTimeoutInMillis = cacheExpiryTimeoutInMillis;
}
- public void setQueueCapacity(int queueCapacity) {
+ void setQueueCapacity(int queueCapacity) {
this.queueCapacity = queueCapacity;
}
this.queueCapacity = queueCapacity;
}
/**
* This method is called to ready a transaction that was prepared by ShardTransaction actor. It caches
* the prepared cohort entry for the given transactions ID in preparation for the subsequent 3-phase commit.
/**
* This method is called to ready a transaction that was prepared by ShardTransaction actor. It caches
* the prepared cohort entry for the given transactions ID in preparation for the subsequent 3-phase commit.
+ *
+ * @param ready the ForwardedReadyTransaction message to process
+ * @param sender the sender of the message
+ * @param shard the transaction's shard actor
- public void handleForwardedReadyTransaction(ForwardedReadyTransaction ready, ActorRef sender, Shard shard) {
+ void handleForwardedReadyTransaction(ForwardedReadyTransaction ready, ActorRef sender, Shard shard) {
log.debug("{}: Readying transaction {}, client version {}", name,
ready.getTransactionID(), ready.getTxnClientVersion());
log.debug("{}: Readying transaction {}, client version {}", name,
ready.getTransactionID(), ready.getTxnClientVersion());
* DOMStoreWriteTransaction, one is created. The batched modifications are applied to the write Tx. If
* the BatchedModifications is ready to commit then a DOMStoreThreePhaseCommitCohort is created.
*
* DOMStoreWriteTransaction, one is created. The batched modifications are applied to the write Tx. If
* the BatchedModifications is ready to commit then a DOMStoreThreePhaseCommitCohort is created.
*
- * @param batched the BatchedModifications
- * @param shardActor the transaction's shard actor
- *
- * @throws ExecutionException if an error occurs loading the cache
+ * @param batched the BatchedModifications message to process
+ * @param sender the sender of the message
+ * @param shard the transaction's shard actor
- void handleBatchedModifications(BatchedModifications batched, ActorRef sender, Shard shard)
- throws ExecutionException {
+ void handleBatchedModifications(BatchedModifications batched, ActorRef sender, Shard shard) {
CohortEntry cohortEntry = cohortCache.get(batched.getTransactionID());
if(cohortEntry == null) {
cohortEntry = new CohortEntry(batched.getTransactionID(),
CohortEntry cohortEntry = cohortCache.get(batched.getTransactionID());
if(cohortEntry == null) {
cohortEntry = new CohortEntry(batched.getTransactionID(),
* This method handles {@link ReadyLocalTransaction} message. All transaction modifications have
* been prepared beforehand by the sender and we just need to drive them through into the dataTree.
*
* This method handles {@link ReadyLocalTransaction} message. All transaction modifications have
* been prepared beforehand by the sender and we just need to drive them through into the dataTree.
*
- * @param message
- * @param sender
- * @param shard
+ * @param message the ReadyLocalTransaction message to process
+ * @param sender the sender of the message
+ * @param shard the transaction's shard actor
*/
void handleReadyLocalTransaction(ReadyLocalTransaction message, ActorRef sender, Shard shard) {
final ShardDataTreeCohort cohort = new SimpleShardDataTreeCohort(dataTree, message.getModification());
*/
void handleReadyLocalTransaction(ReadyLocalTransaction message, ActorRef sender, Shard shard) {
final ShardDataTreeCohort cohort = new SimpleShardDataTreeCohort(dataTree, message.getModification());
/**
* This method handles the canCommit phase for a transaction.
*
/**
* This method handles the canCommit phase for a transaction.
*
- * @param canCommit the CanCommitTransaction message
- * @param sender the actor that sent the message
+ * @param transactionID the ID of the transaction to canCommit
+ * @param sender the actor to which to send the response
* @param shard the transaction's shard actor
*/
* @param shard the transaction's shard actor
*/
- public void handleCanCommit(String transactionID, final ActorRef sender, final Shard shard) {
+ void handleCanCommit(String transactionID, final ActorRef sender, final Shard shard) {
// Lookup the cohort entry that was cached previously (or should have been) by
// transactionReady (via the ForwardedReadyTransaction message).
final CohortEntry cohortEntry = cohortCache.get(transactionID);
// Lookup the cohort entry that was cached previously (or should have been) by
// transactionReady (via the ForwardedReadyTransaction message).
final CohortEntry cohortEntry = cohortCache.get(transactionID);
+ /**
+ * This method handles the preCommit and commit phases for a transaction.
+ *
+ * @param transactionID the ID of the transaction to commit
+ * @param sender the actor to which to send the response
+ * @param shard the transaction's shard actor
+ * @return true if the transaction was successfully prepared, false otherwise.
+ */
boolean handleCommit(final String transactionID, final ActorRef sender, final Shard shard) {
// Get the current in-progress cohort entry in the commitCoordinator if it corresponds to
// this transaction.
boolean handleCommit(final String transactionID, final ActorRef sender, final Shard shard) {
// Get the current in-progress cohort entry in the commitCoordinator if it corresponds to
// this transaction.