import akka.actor.ActorRef;
import akka.actor.Props;
-import akka.actor.UntypedActor;
import akka.japi.Creator;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
/**
* The ShardTransactionChain Actor represents a remote TransactionChain
*/
-public class ShardTransactionChain extends UntypedActor{
+public class ShardTransactionChain extends AbstractUntypedActor{
private final DOMStoreTransactionChain chain;
}
@Override
- public void onReceive(Object message) throws Exception {
+ public void handleReceive(Object message) throws Exception {
if(message instanceof CreateTransaction){
DOMStoreReadWriteTransaction transaction = chain.newReadWriteTransaction();
- ActorRef transactionActor = getContext().actorOf(ShardTransaction.props(transaction));
+ ActorRef transactionActor = getContext().actorOf(ShardTransaction.props(chain, transaction, getContext().parent()));
getSender().tell(new CreateTransactionReply(transactionActor.path()), getSelf());
+ } else if (message instanceof CloseTransactionChain){
+ chain.close();
+ getSender().tell(new CloseTransactionChainReply(), getSelf());
}
}