+ super.onReceiveCommand(message);
+ }
+ }
+
+ private void closeTransactionChain(CloseTransactionChain closeTransactionChain) {
+ DOMStoreTransactionChain chain =
+ transactionChains.remove(closeTransactionChain.getTransactionChainId());
+
+ if(chain != null) {
+ chain.close();
+ }
+ }
+
+ private ActorRef createTypedTransactionActor(
+ int transactionType,
+ ShardTransactionIdentifier transactionId,
+ String transactionChainId ) {
+
+ DOMStoreTransactionFactory factory = store;
+
+ if(!transactionChainId.isEmpty()) {
+ factory = transactionChains.get(transactionChainId);
+ if(factory == null){
+ DOMStoreTransactionChain transactionChain = store.createTransactionChain();
+ transactionChains.put(transactionChainId, transactionChain);
+ factory = transactionChain;
+ }
+ }
+
+ if(this.schemaContext == null){
+ throw new NullPointerException("schemaContext should not be null");
+ }
+
+ if (transactionType
+ == TransactionProxy.TransactionType.READ_ONLY.ordinal()) {
+
+ shardMBean.incrementReadOnlyTransactionCount();
+
+ return getContext().actorOf(
+ ShardTransaction.props(factory.newReadOnlyTransaction(), getSelf(),
+ schemaContext,datastoreContext, shardMBean), transactionId.toString());
+
+ } else if (transactionType
+ == TransactionProxy.TransactionType.READ_WRITE.ordinal()) {
+
+ shardMBean.incrementReadWriteTransactionCount();
+
+ return getContext().actorOf(
+ ShardTransaction.props(factory.newReadWriteTransaction(), getSelf(),
+ schemaContext, datastoreContext, shardMBean), transactionId.toString());
+
+
+ } else if (transactionType
+ == TransactionProxy.TransactionType.WRITE_ONLY.ordinal()) {
+
+ shardMBean.incrementWriteOnlyTransactionCount();
+
+ return getContext().actorOf(
+ ShardTransaction.props(factory.newWriteOnlyTransaction(), getSelf(),
+ schemaContext, datastoreContext, shardMBean), transactionId.toString());
+ } else {
+ throw new IllegalArgumentException(
+ "Shard="+name + ":CreateTransaction message has unidentified transaction type="
+ + transactionType);