public IdentifiedDataSerializable createNew(Integer arg) { return new JoinMessage(); } };
public IdentifiedDataSerializable createNew(Integer arg) { return new JoinMessage(); } };
@Override protected void readInternal(ObjectDataInput in) throws IOException { joinMessage = new JoinMessage(); joinMessage.readData(in); }
@Override protected void readInternal(ObjectDataInput in) throws IOException { joinMessage = new JoinMessage(); joinMessage.readData(in); }
public class MessageSender extends UntypedActor { public static Props props(ActorRef out) { return Props.create(MessageSender.class, out); } private final ActorRef out; private final ActorRef router; public MessageSender(ActorRef out) { this.out = out; this.router= getContext().actorSelection("/Path/To/WebSocketRouter"); } @Override public void preStart() { router.tell(new JoinMessage(), getSelf()); } @Override public void onReceive(Object message) throws Exception { if (message instanceof String) { out.tell(message, getSelf()); } else { unhandled(message); } } }
/** * Send a {@link WhoisMasterOp} to designated address. * * @param toAddress the address to which the operation will be sent. * @return {@code true} if the operation was sent, otherwise {@code false}. */ public boolean sendMasterQuestion(Address toAddress) { checkNotNull(toAddress, "No endpoint is specified!"); BuildInfo buildInfo = node.getBuildInfo(); final Address thisAddress = node.getThisAddress(); JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(), thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress); }
/** * Send a {@link WhoisMasterOp} to designated address. * * @param toAddress the address to which the operation will be sent. * @return {@code true} if the operation was sent, otherwise {@code false}. */ public boolean sendMasterQuestion(Address toAddress) { checkNotNull(toAddress, "No endpoint is specified!"); BuildInfo buildInfo = node.getBuildInfo(); final Address thisAddress = node.getThisAddress(); JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(), thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress); }
private void handleActiveAndJoined(JoinMessage joinMessage) { if (!(joinMessage instanceof JoinRequest)) { logDroppedMessage(joinMessage); return; } ClusterServiceImpl clusterService = node.getClusterService(); Address masterAddress = clusterService.getMasterAddress(); if (clusterService.isMaster()) { JoinMessage response = new JoinMessage(Packet.VERSION, node.getBuildInfo().getBuildNumber(), node.getVersion(), node.getThisAddress(), node.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); node.multicastService.send(response); } else if (joinMessage.getAddress().equals(masterAddress)) { MemberImpl master = node.getClusterService().getMember(masterAddress); if (master != null && !master.getUuid().equals(joinMessage.getUuid())) { String message = "New join request has been received from current master. Suspecting " + masterAddress; logger.warning(message); // I just make a local suspicion. Probably other nodes will eventually suspect as well. clusterService.suspectMember(master, message, false); } } }
private void handleActiveAndJoined(JoinMessage joinMessage) { if (!(joinMessage instanceof JoinRequest)) { logDroppedMessage(joinMessage); return; } ClusterServiceImpl clusterService = node.getClusterService(); Address masterAddress = clusterService.getMasterAddress(); if (clusterService.isMaster()) { JoinMessage response = new JoinMessage(Packet.VERSION, node.getBuildInfo().getBuildNumber(), node.getVersion(), node.getThisAddress(), node.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); node.multicastService.send(response); } else if (joinMessage.getAddress().equals(masterAddress)) { MemberImpl master = node.getClusterService().getMember(masterAddress); if (master != null && !master.getUuid().equals(joinMessage.getUuid())) { String message = "New join request has been received from current master. Suspecting " + masterAddress; logger.warning(message); // I just make a local suspicion. Probably other nodes will eventually suspect as well. clusterService.suspectMember(master, message, false); } } }