@Override public void read(ObjectInput in) throws IOException, ClassNotFoundException { registrarID = new ServiceID(in); }
/** * Two announcements are equal if they have the same service ID. */ public boolean equals(Object o) { return o instanceof IncomingMulticastAnnouncement && ((IncomingMulticastAnnouncement) o).serviceID.equals(serviceID); } }
@Override public int compare(ServiceItem o1, ServiceItem o2) { ServiceID srvID_1 = o1.serviceID; ServiceID srvID_2 = o2.serviceID; // The ordering is intentionally set up so that the UUIDs // can simply be numerically compared as two numbers return (srvID_1.getMostSignificantBits() < srvID_2.getMostSignificantBits() ? -1 : (srvID_1.getMostSignificantBits() > srvID_2.getMostSignificantBits() ? 1 : (srvID_1.getLeastSignificantBits() < srvID_2.getLeastSignificantBits() ? -1 : (srvID_1.getLeastSignificantBits() > srvID_2.getLeastSignificantBits() ? 1 : 0)))); } });
/** * Writes the default serializable field values for this instance, followed * by the registrar's service ID encoded as specified by the * ServiceID.writeBytes method. */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); registrarID.writeBytes(out); }
/** Returns service ID hash code. */ @Override public int hashCode() { return registrarID.hashCode(); }
/** * Call back function that receive as parameter the <code>serviceID</code> of registered * service. * * @param serviceID ServiceID of registered service. **/ public void serviceIDNotify(ServiceID serviceID) { if (_logger.isLoggable(Level.INFO)) { _logger.info("<" + m_ContainerName + "> container registered with " + serviceID.toString() + " serviceID successfully."); } }
/** * Returns a 36-character string of five fields separated by hyphens, with each field * represented in lowercase hexadecimal with the same number of digits as in the field. The * order of fields is: <code>time_low</code>, <code>time_mid</code>, <code>version</code> and * <code>time_hi</code> treated as a single field, <code>variant</code> and * <code>clock_seq</code> treated as a single field, and <code>node</code>. */ public String toString() { return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(leastSig, 12)); }
/** * Writes the default serializable field value for this instance, followed * by the registrar's service ID encoded as specified by the * ServiceID.writeBytes method. */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); registrarID.writeBytes(out); }
/** * Returns service ID hash code. */ public int hashCode() { return registrarID.hashCode(); }
private void logInfoShutdown() { if (startupLogger.isLoggable(Level.INFO)) { startupLogger.log (Level.INFO, "Fiddler destroyed: {0}, {1}, {2}", new Object[] { (FiddlerImpl.this.serviceID).toString(), writeGroupArrayToString(thisServicesGroups), writeArrayElementsToString(thisServicesLocators) } ); }//endif }//end logInfoShutdown
/** * Returns a 36-character string of five fields separated by hyphens, with * each field represented in lowercase hexadecimal with the same number of * digits as in the field. The order of fields is: <code>time_low</code>, * <code>time_mid</code>, <code>version</code> and <code>time_hi</code> * treated as a single field, <code>variant</code> and * <code>clock_seq</code> treated as a single field, and <code>node</code>. */ public String toString() { return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(leastSig, 12)); }
@Override public void read(ObjectInput in) throws IOException, ClassNotFoundException { registrarID = new ServiceID(in); }
@Override public int compare(ServiceItem o1, ServiceItem o2) { ServiceID srvID_1 = o1.serviceID; ServiceID srvID_2 = o2.serviceID; // The ordering is intentionally set up so that the UUIDs // can simply be numerically compared as two numbers return (srvID_1.getMostSignificantBits() < srvID_2.getMostSignificantBits() ? -1 : (srvID_1.getMostSignificantBits() > srvID_2.getMostSignificantBits() ? 1 : (srvID_1.getLeastSignificantBits() < srvID_2.getLeastSignificantBits() ? -1 : (srvID_1.getLeastSignificantBits() > srvID_2.getLeastSignificantBits() ? 1 : 0)))); } });
/** * Returns the element in the given items array having the given ServiceID. */ private ServiceItem findItem(ServiceID sid, ServiceItem[] items) { if (items != null) { for (int i = 0; i < items.length; i++) { if (items[i].serviceID.equals(sid)) return items[i]; }//end loop }//endif return null; }//end LookupCacheImpl.findItem
/** * Writes the default serializable field value for this instance, followed * by the registrar's service ID encoded as specified by the * ServiceID.writeBytes method. */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); registrarID.writeBytes(out); }
@Override public int hashCode() { return registrarID.hashCode(); }
private void logInfoStartup() { if (startupLogger.isLoggable(Level.INFO)) { startupLogger.log (Level.INFO, "Fiddler started: {0}, {1}, {2}", new Object[] { (FiddlerImpl.this.serviceID).toString(), writeGroupArrayToString(thisServicesGroups), writeArrayElementsToString(thisServicesLocators) } ); }//endif if( startupLogger.isLoggable(Level.CONFIG) ) { if(persistDir != null) { startupLogger.log(Level.CONFIG, " Persistent state directory: {0}", persistDir); }//endif startupLogger.log(Level.CONFIG, "Attributes to register in each lookup service: "); writeAttributes(thisServicesAttrs,startupLogger,Level.CONFIG); }//endif }//end logInfoStartup
@Override public void read(ObjectInput input) throws IOException, ClassNotFoundException { serviceID = new ServiceID(input); }
@Override public Uuid getReferentUuid() { return UuidFactory.create(registrarID.getMostSignificantBits(), registrarID.getLeastSignificantBits()); }
/** * Two leases can be batched if they are both RegistrarLeases and have the same server. */ public boolean canBatch(Lease lease) { return (lease instanceof RegistrarLease && registrarID.equals(((RegistrarLease) lease).registrarID)); }