private boolean isValidJoinMessage(Object msg) { if (!isJoinMessage(msg)) { return false; } JoinMessage joinMessage = (JoinMessage) msg; if (isMessageToSelf(joinMessage)) { return false; } ConfigCheck theirConfig = joinMessage.getConfigCheck(); if (!ourConfig.isSameGroup(theirConfig)) { return false; } return true; }
private boolean isValidJoinMessage(Object msg) { if (!isJoinMessage(msg)) { return false; } JoinMessage joinMessage = (JoinMessage) msg; if (isMessageToSelf(joinMessage)) { return false; } ConfigCheck theirConfig = joinMessage.getConfigCheck(); if (!ourConfig.isSameGroup(theirConfig)) { return false; } return true; }
/** * Validate that the configuration received from the remote node in {@code joinMessage} is compatible with the * configuration of this node. * * @param joinMessage the {@link JoinMessage} received from another node. * @return {@code true} if packet version of join message matches this node's packet version and configurations * are found to be compatible, otherwise {@code false}. * @throws Exception in case any exception occurred while checking compatibilty * @see ConfigCheck */ public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception { if (joinMessage.getPacketVersion() != Packet.VERSION) { return false; } try { ConfigCheck newMemberConfigCheck = joinMessage.getConfigCheck(); ConfigCheck clusterConfigCheck = node.createConfigCheck(); return clusterConfigCheck.isCompatible(newMemberConfigCheck); } catch (Exception e) { logger.warning(format("Invalid join request from %s, cause: %s", joinMessage.getAddress(), e.getMessage())); throw e; } }
/** * Validate that the configuration received from the remote node in {@code joinMessage} is compatible with the * configuration of this node. * * @param joinMessage the {@link JoinMessage} received from another node. * @return {@code true} if packet version of join message matches this node's packet version and configurations * are found to be compatible, otherwise {@code false}. * @throws Exception in case any exception occurred while checking compatibilty * @see ConfigCheck */ public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception { if (joinMessage.getPacketVersion() != Packet.VERSION) { return false; } try { ConfigCheck newMemberConfigCheck = joinMessage.getConfigCheck(); ConfigCheck clusterConfigCheck = node.createConfigCheck(); return clusterConfigCheck.isCompatible(newMemberConfigCheck); } catch (Exception e) { logger.warning(format("Invalid join request from %s, cause: %s", joinMessage.getAddress(), e.getMessage())); throw e; } }