public boolean equals( Object other ) { if (this == other) { // check if this and other are both same Peerid. Works if both are NULL_PEER_ID. return true; } else if( other instanceof PeerID ) { boolean equal = true; PeerID otherPeerID = (PeerID)other; if( uniqueID != null && uniqueID.equals( otherPeerID.getUniqueID() ) ) { if( groupName != null ) equal = groupName.equals( otherPeerID.getGroupName() ); if( !equal ) return false; if( instanceName != null ) equal = instanceName.equals( otherPeerID.getInstanceName() ); if( !equal ) return false; } else { return false; } return true; } else { return false; } }
public boolean equals( Object other ) { if (this == other) { // check if this and other are both same Peerid. Works if both are NULL_PEER_ID. return true; } else if( other instanceof PeerID ) { boolean equal = true; PeerID otherPeerID = (PeerID)other; if( uniqueID != null && uniqueID.equals( otherPeerID.getUniqueID() ) ) { if( groupName != null ) equal = groupName.equals( otherPeerID.getGroupName() ); if( !equal ) return false; if( instanceName != null ) equal = instanceName.equals( otherPeerID.getInstanceName() ); if( !equal ) return false; } else { return false; } return true; } else { return false; } }
public boolean resend(PeerID to, Long seqId) throws IOException { boolean result = false; ReliableBroadcast rb = sendHistory.get(seqId); if (rb != null) { Message msg = rb.msg; msg.addMessageElement("RESEND", Boolean.TRUE); result = manager.getNetworkManager().send(to, rb.msg); rb.resends++; if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "mgmt.reliable.mcast.resend", new Object[]{seqId, to.getInstanceName(),to.getGroupName(), rb.resends, clusterViewEventMsgToString(msg)}); } } else if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "mgmt.reliable.mcast.resend.failed", new Object[]{seqId, to.getInstanceName(),to.getGroupName()}); } return result; }
@Override @SuppressWarnings("unchecked") public int compareTo( PeerID other ) { if( this == other ) return 0; if( other == null ) return 1; if (this == NULL_PEER_ID) { return -1; } int result = groupName.compareTo(other.getGroupName()); if (result != 0) { return result; } result = instanceName.compareTo(other.getInstanceName()); if (result != 0) { return result; } final Class<T> uniqueIDClass = (Class<T>) uniqueID.getClass(); if (Comparable.class.isAssignableFrom(uniqueIDClass) && uniqueIDClass.isAssignableFrom(other.getUniqueID().getClass())) { return ((Comparable<T>) uniqueID).compareTo((T) other.getUniqueID()); } else { return uniqueID.toString().compareTo(other.getUniqueID().toString()); } } }
public boolean resend(PeerID to, Long seqId) throws IOException { boolean result = false; ReliableBroadcast rb = sendHistory.get(seqId); if (rb != null) { Message msg = rb.msg; msg.addMessageElement("RESEND", Boolean.TRUE); result = manager.getNetworkManager().send(to, rb.msg); rb.resends++; if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "mgmt.reliable.mcast.resend", new Object[]{seqId, to.getInstanceName(),to.getGroupName(), rb.resends, clusterViewEventMsgToString(msg)}); } } else if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "mgmt.reliable.mcast.resend.failed", new Object[]{seqId, to.getInstanceName(),to.getGroupName()}); } return result; }
@Override @SuppressWarnings("unchecked") public int compareTo( PeerID other ) { if( this == other ) return 0; if( other == null ) return 1; if (this == NULL_PEER_ID) { return -1; } int result = groupName.compareTo(other.getGroupName()); if (result != 0) { return result; } result = instanceName.compareTo(other.getInstanceName()); if (result != 0) { return result; } final Class<T> uniqueIDClass = (Class<T>) uniqueID.getClass(); if (Comparable.class.isAssignableFrom(uniqueIDClass) && uniqueIDClass.isAssignableFrom(other.getUniqueID().getClass())) { return ((Comparable<T>) uniqueID).compareTo((T) other.getUniqueID()); } else { return uniqueID.toString().compareTo(other.getUniqueID().toString()); } } }
localPeerID.getGroupName(), multicastAddress, multicastPort ), localPeerID.getGroupName(),
localPeerID.getGroupName(), multicastAddress, multicastPort ), localPeerID.getGroupName(),
targetPeerID = (PeerID)element; if( sourcePeerID != null && !localPeerID.getGroupName().equals( sourcePeerID.getGroupName() ) ) return; // drop the different group's packet
targetPeerID = (PeerID)element; if( sourcePeerID != null && !localPeerID.getGroupName().equals( sourcePeerID.getGroupName() ) ) return; // drop the different group's packet