I developed a cluster with two nodes using the java language.Start node A and node B.When node B starts,an actor is created named “/user/bactor”.Remotely access the actors in node B from node A:
Timeout timeout = new Timeout(2000,TimeUnit.SECONDS);
getContext().classicActorContext().actorSelection("akka://test@127.0.0.1:8081/user/bactor");
AskableActorSelection asker = new AskableActorSelection(sel);
Future<Object> future = asker.ask(new Identify(1),);
ActorIdentity ident = (ActorIdentity) Await.result(future,timeout.duration());
.....
At this time ,the above code is OK.Then,after stopping node B,send the request again , the console will also print exceptions and it will block in “Await.result()”.Exception are as follows :
Caller+0 at akka.event.slf4j.Slf4jLogger$$anonfun$receive$1.$anonfun$applyOrElse$2(Slf4jLogger.scala:92)
[outbound connection to [akka://test@127.0.0.1:8081], message stream] Upstream failed , cause: StreamTcpException:Tcp command [Connect(127.0.0.1:8081,None,List(),Some(5000 milliseconds),true)]
failed because of java.net.ConnectException:Connection refused : no further information