public UUID copy() { return new UUID(mostSigBits, leastSigBits); }
public UUID copy() { return new UUID(mostSigBits, leastSigBits); }
public UUID copy() { return new UUID(mostSigBits, leastSigBits); }
/** * Static factory to retrieve a type 4 (pseudo randomly generated) UUID. * The {@code UUID} is generated using a cryptographically strong pseudo random number generator. * @return A randomly generated {@code UUID} */ public static UUID randomUUID() { return new UUID(generateRandomBytes()); }
/** * Static factory to retrieve a type 4 (pseudo randomly generated) UUID. * The {@code UUID} is generated using a cryptographically strong pseudo random number generator. * @return A randomly generated {@code UUID} */ public static UUID randomUUID() { return new UUID(generateRandomBytes()); }
/** * Static factory to retrieve a type 4 (pseudo randomly generated) UUID. * The {@code UUID} is generated using a cryptographically strong pseudo random number generator. * @return A randomly generated {@code UUID} */ public static UUID randomUUID() { return new UUID(generateRandomBytes()); }
public Address generateAddress() { if(first) { first=false; return new UUID(0, initial_val); } return Util.createRandomAddress(); } }
public Address generateAddress() { if(first) { first=false; return new UUID(0, initial_val); } return Util.createRandomAddress(); } }
public Address generateAddress() { if(first) { first=false; return new UUID(0, initial_val); } return Util.createRandomAddress(); } }
/** * Creates a {@code UUID} from the string standard representation as * described in the {@link #toString} method. * * @param name * A string that specifies a {@code UUID} * * @return A {@code UUID} with the specified value * * @throws IllegalArgumentException * If name does not conform to the string representation as * described in {@link #toString} * */ public static UUID fromString(String name) { String[] components = name.split("-"); if (components.length != 5) throw new IllegalArgumentException("Invalid UUID string: "+name); for (int i=0; i<5; i++) components[i] = "0x"+components[i]; long mostSigBits =Long.decode(components[0]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[1]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[2]); long leastSigBits =Long.decode(components[3]); leastSigBits <<= 48; leastSigBits |=Long.decode(components[4]); return new UUID(mostSigBits, leastSigBits); }
/** * Creates a {@code UUID} from the string standard representation as * described in the {@link #toString} method. * * @param name * A string that specifies a {@code UUID} * * @return A {@code UUID} with the specified value * * @throws IllegalArgumentException * If name does not conform to the string representation as * described in {@link #toString} * */ public static UUID fromString(String name) { String[] components = name.split("-"); if (components.length != 5) throw new IllegalArgumentException("Invalid UUID string: "+name); for (int i=0; i<5; i++) components[i] = "0x"+components[i]; long mostSigBits =Long.decode(components[0]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[1]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[2]); long leastSigBits =Long.decode(components[3]); leastSigBits <<= 48; leastSigBits |=Long.decode(components[4]); return new UUID(mostSigBits, leastSigBits); }
/** * Creates a {@code UUID} from the string standard representation as * described in the {@link #toString} method. * * @param name * A string that specifies a {@code UUID} * * @return A {@code UUID} with the specified value * * @throws IllegalArgumentException * If name does not conform to the string representation as * described in {@link #toString} * */ public static UUID fromString(String name) { String[] components = name.split("-"); if (components.length != 5) throw new IllegalArgumentException("Invalid UUID string: "+name); for (int i=0; i<5; i++) components[i] = "0x"+components[i]; long mostSigBits =Long.decode(components[0]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[1]); mostSigBits <<= 16; mostSigBits |=Long.decode(components[2]); long leastSigBits =Long.decode(components[3]); leastSigBits <<= 48; leastSigBits |=Long.decode(components[4]); return new UUID(mostSigBits, leastSigBits); }
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg) { Address local_dest; boolean send_to_coord=false; if(dest instanceof SiteUUID) { if(dest instanceof SiteMaster) { local_dest=pickSiteMaster(sender); if(local_dest == null) throw new IllegalStateException("site master was null"); send_to_coord=true; } else { SiteUUID tmp=(SiteUUID)dest; local_dest=new UUID(tmp.getMostSignificantBits(), tmp.getLeastSignificantBits()); } } else local_dest=dest; if(log.isTraceEnabled()) log.trace(local_addr + ": delivering message to " + dest + " in local cluster"); long start=stats? System.nanoTime() : 0; forwardTo(local_dest, dest, sender, msg, send_to_coord); if(stats) { forward_to_local_mbr_time.addAndGet(System.nanoTime() - start); forward_to_local_mbr.incrementAndGet(); } }
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg) { Address local_dest; boolean send_to_coord=false; if(dest instanceof SiteUUID) { if(dest instanceof SiteMaster) { local_dest=pickSiteMaster(sender); if(local_dest == null) throw new IllegalStateException("site master was null"); send_to_coord=true; } else { SiteUUID tmp=(SiteUUID)dest; local_dest=new UUID(tmp.getMostSignificantBits(), tmp.getLeastSignificantBits()); } } else local_dest=dest; if(log.isTraceEnabled()) log.trace(local_addr + ": delivering message to " + dest + " in local cluster"); long start=stats? System.nanoTime() : 0; forwardTo(local_dest, dest, sender, msg, send_to_coord); if(stats) { forward_to_local_mbr_time.addAndGet(System.nanoTime() - start); forward_to_local_mbr.incrementAndGet(); } }
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg) { Address local_dest; boolean send_to_coord=false; if(dest instanceof SiteUUID) { if(dest instanceof SiteMaster) { local_dest=pickSiteMaster(sender); if(local_dest == null) throw new IllegalStateException("site master was null"); send_to_coord=true; } else { SiteUUID tmp=(SiteUUID)dest; local_dest=new UUID(tmp.getMostSignificantBits(), tmp.getLeastSignificantBits()); } } else local_dest=dest; if(log.isTraceEnabled()) log.trace(local_addr + ": delivering message to " + dest + " in local cluster"); long start=stats? System.nanoTime() : 0; forwardTo(local_dest, dest, sender, msg, send_to_coord); if(stats) { forward_to_local_mbr_time.addAndGet(System.nanoTime() - start); forward_to_local_mbr.incrementAndGet(); } }
try { long tmp=Long.valueOf(uuid_str); uuid=new UUID(0, tmp);
try { long tmp=Long.valueOf(uuid_str); uuid=new UUID(0, tmp);
public static Address readAddress(DataInput in) throws Exception { byte flags=in.readByte(); if(Util.isFlagSet(flags,Address.NULL)) return null; Address addr; if(Util.isFlagSet(flags,Address.UUID_ADDR)) { addr=new UUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_UUID)) { addr=new SiteUUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_MASTER)) { addr=new SiteMaster(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.IP_ADDR)) { addr=new IpAddress(); addr.readFrom(in); } else { addr=readOtherAddress(in); } return addr; }
public static Address readAddress(DataInput in) throws Exception { byte flags=in.readByte(); if(Util.isFlagSet(flags,Address.NULL)) return null; Address addr; if(Util.isFlagSet(flags,Address.UUID_ADDR)) { addr=new UUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_UUID)) { addr=new SiteUUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_MASTER)) { addr=new SiteMaster(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.IP_ADDR)) { addr=new IpAddress(); addr.readFrom(in); } else { addr=readOtherAddress(in); } return addr; }
public static Address readAddress(DataInput in) throws Exception { byte flags=in.readByte(); if(Util.isFlagSet(flags,Address.NULL)) return null; Address addr; if(Util.isFlagSet(flags,Address.UUID_ADDR)) { addr=new UUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_UUID)) { addr=new SiteUUID(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.SITE_MASTER)) { addr=new SiteMaster(); addr.readFrom(in); } else if(Util.isFlagSet(flags,Address.IP_ADDR)) { addr=new IpAddress(); addr.readFrom(in); } else { addr=readOtherAddress(in); } return addr; }