public void notify(RemoteEvent evt) { ServiceEvent theEvent = (ServiceEvent) evt; notifyServiceMap(theEvent.getSource(), theEvent.getID(), theEvent.getSequenceNumber(), theEvent.getServiceID(), theEvent.getServiceItem(), theEvent.getTransition()); }//end notify
StringBuilder sBuffer = new StringBuilder(256); sBuffer.append(getClass().getName()).append( "[serviceID=").append(getServiceID()).append( ", transition="); switch (getTransition()) { case ServiceRegistrar.TRANSITION_MATCH_MATCH: sBuffer.append("TRANSITION_MATCH_MATCH"); transition); sBuffer.append(", source=").append(getSource()).append( ", eventID=").append(getID()).append( ", seqNum=").append(getSequenceNumber()).append( ", handback=").append(getRegistrationObject()).append( ", miHandback=").append(getRegistrationInstance()); return sBuffer.append("]").toString();
/** * Returns a <code>String</code> representation of this <code>ServiceEvent</code>. * * @return a <code>String</code> representation of this object */ public String toString() { StringBuffer sBuffer = new StringBuffer(); sBuffer.append(getClass().getName()).append( "[serviceID=").append(getServiceID()).append( ", transition="); switch (getTransition()) { case ServiceRegistrar.TRANSITION_MATCH_MATCH: sBuffer.append("TRANSITION_MATCH_MATCH"); break; case ServiceRegistrar.TRANSITION_MATCH_NOMATCH: sBuffer.append("TRANSITION_MATCH_NOMATCH"); break; case ServiceRegistrar.TRANSITION_NOMATCH_MATCH: sBuffer.append("TRANSITION_NOMATCH_MATCH"); break; default: sBuffer.append("UNKNOWN_TRANSITION:").append( transition); } sBuffer.append(", source=").append(source).append( ", eventID=").append(getID()).append( ", seqNum=").append(getSequenceNumber()).append( ", handback=").append(getRegistrationObject()); return sBuffer.append("]").toString(); }
@Override public int compareTo(Object o) { if (!(o instanceof HandleServiceEventTask)) return 0; HandleServiceEventTask that = (HandleServiceEventTask) o; long dif = this.theEvent.getSequenceNumber() - that.theEvent.getSequenceNumber(); if (dif == 0) return 0; if (dif < 0) return -1; // Which means that.theEvent is larger than this.theEvent return 1; } }
public void run() { if (eventID == ev.getID() && seqNo < ev.getSequenceNumber()) { seqNo = ev.getSequenceNumber(); attrPanel.receiveNotify(((ServiceEvent) ev).getTransition()); } } }));
/** * Called by the lookupListener's notify() method * * @param theEvent */ private void notifyServiceMap(ServiceEvent theEvent){ if (theEvent.getSource() == null) { return; } if (ServiceDiscoveryManager.logger.isLoggable(Level.FINE)){ ServiceDiscoveryManager.log( Level.FINE, "HandleServiceEventTask submitted" ); } incomingEventExecutor.submit(new HandleServiceEventTask(this, theEvent)); }
if (item == null){ if (cache.useInsecureLookup){ item = theEvent.getServiceItem(); } else { Object proxy = theEvent.getBootstrapProxy(); if (proxy != null){ Entry [] attributes; item = new ServiceItem(theEvent.getServiceID(), proxy, attributes); } catch (IOException ex) { if (ServiceDiscoveryManager.logger.isLoggable(Level.FINE)){ Map.Entry<ProxyReg, EventReg> e = iter.next(); eReg = e.getValue(); if (theEvent.getID() == eReg.eventID && theEvent.getSource().equals(eReg.source)) { reg = e.getKey(); break FIND_ProxyReg; synchronized (eReg){ if (eReg.discarded()) return; if (eReg.nonContiguousEvent(theEvent.getSequenceNumber()) && (currentTime - timestamp < 500)) // 1/2 seconds. theEvent.getSequenceNumber())) delta = eReg.updateSeqNo(theEvent.getSequenceNumber()); theEvent.getServiceID(),