- TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
- if(localContext != null) {
- transactionContextAdapter.executePriorTransactionOperations(localContext);
- } else {
- RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextAdapter,
- parent, shardName);
- remote.setPrimaryShard(primaryShardInfo.getPrimaryShardActor(), primaryShardInfo.getPrimaryShardVersion());
+ try {
+ TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
+ if (localContext != null) {
+ transactionContextWrapper.executePriorTransactionOperations(localContext);
+ } else {
+ RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextWrapper,
+ parent, shardName);
+ remote.setPrimaryShard(primaryShardInfo);
+ }
+ } finally {
+ onTransactionContextCreated(parent.getIdentifier());