/** * Creates a Entry with id and state * * @param adv SystemAdvertisement * @param state state value * @param seqID health message sequence ID */ public Entry(final SystemAdvertisement adv, final String state, long seqID) { this.state = state; this.adv = adv; this.id = (PeerID) adv.getID(); this.timestamp =System.currentTimeMillis(); this.seqID = seqID; }
/** * Resets the view */ void reset() { viewLock.lock(); try { view.clear(); view.put(advertisement.getID(), advertisement); } finally { viewLock.unlock(); } }
/** * Resets the view */ void reset() { viewLock.lock(); try { view.clear(); view.put(advertisement.getID(), advertisement); } finally { viewLock.unlock(); } }
/** * Determines whether this node is at the top of the list * * @param advertisement the advertisement to test * @return true if this node is a the top of the list, false otherwise */ public boolean isFirst(SystemAdvertisement advertisement) { final PeerID id = view.firstKey(); return advertisement.getID().equals(id); }
/** * Returns the address representing the peer identified by this process. The * address object is of the type corresponding to the underlying GCP. In * this case, the jxta ID of this peer is returned. * * @return Object - representing this peer's address. */ public Object getLocalAddress() { return clusterManager.getSystemAdvertisement().getID(); }
/** * Returns the address representing the peer identified by this process. The * address object is of the type corresponding to the underlying GCP. In * this case, the jxta ID of this peer is returned. * * @return Object - representing this peer's address. */ public Object getLocalAddress() { return clusterManager.getSystemAdvertisement().getID(); }
/** * Determines whether this node is at the top of the list * * @param advertisement the advertisement to test * @return true if this node is a the top of the list, false otherwise */ public boolean isFirst(SystemAdvertisement advertisement) { final PeerID id = view.firstKey(); return advertisement.getID().equals(id); }
/** * Determines whether this node is at the top of the list * * @return true if this node is a the top of the list, false otherwise */ public boolean isFirst() { final PeerID id = view.firstKey(); return advertisement.getID().equals(id); }
/** * Determines whether this node is at the top of the list * * @return true if this node is a the top of the list, false otherwise */ public boolean isFirst() { final PeerID id = view.firstKey(); return advertisement.getID().equals(id); }
/** * Returns master node ID * * @return The master node ID */ PeerID getMasterNodeID() { return clusterViewManager.getMaster().getID(); }
/** * Returns master node ID * * @return The master node ID */ PeerID getMasterNodeID() { return clusterViewManager.getMaster().getID(); }
public boolean addHealthEntryIfMissing(final SystemAdvertisement adv) { final PeerID id = adv.getID(); synchronized(cacheLock) { HealthMessage.Entry entry = cache.get(id); if (entry == null) { final long BEFORE_FIRST_HEALTHMESSAGE_SEQ_ID = 0; entry = new HealthMessage.Entry(adv, states[STARTING], BEFORE_FIRST_HEALTHMESSAGE_SEQ_ID); HealthMessage.Entry result = cache.putIfAbsent(id, entry); return result == null; } else { return false; } } }
/** * {@inheritDoc} */ public int compareTo(final SystemAdvertisement other) { return getID().compareTo(other.getID()); }
/** * {@inheritDoc} */ public int compareTo(final SystemAdvertisement other) { return getID().compareTo(other.getID()); }
/** * {@inheritDoc} */ @Override public boolean equals(final Object obj) { boolean retVal = false; if (this == obj) { retVal = true; } else if (obj instanceof SystemAdvertisement) { final SystemAdvertisement adv = (SystemAdvertisement) obj; retVal = getID().equals(adv.getID()); } return retVal; }
private SystemAdvertisement getNodeAdvertisement(Message msg) { SystemAdvertisement adv = null; Object value = msg.getMessageElement( NODEADV ); if( value instanceof SystemAdvertisement ) { adv = (SystemAdvertisement)value; if( !adv.getID().equals( localPeerID ) ) { if( LOG.isLoggable( Level.FINER ) ) { LOG.log( Level.FINER, "Received a System advertisement Name :" + adv.getName() ); } } } return adv; }
private void announceMaster(SystemAdvertisement adv) { if (reliableMulticast != null) { reliableMulticast.stop(); reliableMulticast = null; } reliableMulticast = new ReliableMulticast(manager); final Message msg = createMasterResponse(true, adv.getID()); final ClusterViewEvent cvEvent = new ClusterViewEvent(ClusterViewEvents.MASTER_CHANGE_EVENT, adv); if(masterAssigned && isMaster()){ LOG.log(Level.INFO, "mgmt.masternode.announcemasternode", new Object[]{clusterViewManager.getViewSize(), manager.getInstanceName(), manager.getGroupName()}); sendNewView(null, cvEvent, msg, true); } }
private void announceMaster(SystemAdvertisement adv) { if (reliableMulticast != null) { reliableMulticast.stop(); reliableMulticast = null; } reliableMulticast = new ReliableMulticast(manager); final Message msg = createMasterResponse(true, adv.getID()); final ClusterViewEvent cvEvent = new ClusterViewEvent(ClusterViewEvents.MASTER_CHANGE_EVENT, adv); if(masterAssigned && isMaster()){ LOG.log(Level.INFO, "mgmt.masternode.announcemasternode", new Object[]{clusterViewManager.getViewSize(), manager.getInstanceName(), manager.getGroupName()}); sendNewView(null, cvEvent, msg, true); } }