String boundedMailBox = actorSystem.name() + ".bounded-mailbox";
ActorRef pingPongActor = actorSystem.actorOf(PingPongActor.props(lock).withMailbox(boundedMailBox),
"pingpongactor");
String boundedMailBox = actorSystem.name() + ".bounded-mailbox";
ActorRef pingPongActor = actorSystem.actorOf(PingPongActor.props(lock).withMailbox(boundedMailBox),
"pingpongactor");
- if ("ping".equals(message))
- getSender().tell("pong", getSelf());
+ try {
+ if ("ping".equals(message))
+ getSender().tell("pong", getSelf());
+ } finally {
+ lock.unlock();
+ }