本文整理了Java中org.jgroups.util.UUID.<init>()
方法的一些代码示例,展示了UUID.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.<init>()
方法的具体详情如下:
包路径:org.jgroups.util.UUID
类名称:UUID
方法名:<init>
[英]Private constructor which uses a byte array to construct the new UUID
[中]使用字节数组构造新UUID的私有构造函数
代码示例来源:origin: wildfly/wildfly
public UUID copy() {
return new UUID(mostSigBits, leastSigBits);
}
代码示例来源:origin: apache/geode
/**
* return the jgroups logical address for this member, if it's been established
*/
public UUID getUUID() {
if (this.uuidLSBs == 0 && this.uuidMSBs == 0) {
return null;
}
return new UUID(this.uuidMSBs, this.uuidLSBs);
}
代码示例来源:origin: wildfly/wildfly
public Address generateAddress() {
if(first) {
first=false;
return new UUID(0, initial_val);
}
return Util.createRandomAddress();
}
}
代码示例来源:origin: wildfly/wildfly
/**
* 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(16));
}
代码示例来源:origin: wildfly/wildfly
/**
* 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);
}
代码示例来源:origin: wildfly/wildfly
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.add(System.nanoTime() - start);
forward_to_local_mbr.increment();
}
}
代码示例来源:origin: apache/geode
private GMSMember createGMSMember(byte[] inetAddress, int viewId, long msb, long lsb) {
GMSMember member = new GMSMember();
InetAddress addr1 = mock(InetAddress.class);
when(addr1.getAddress()).thenReturn(inetAddress);
member.setInetAddr(addr1);
member.setBirthViewId(viewId);
member.setUUID(new UUID(msb, lsb));
return member;
}
代码示例来源:origin: wildfly/wildfly
try {
long tmp=Long.valueOf(uuid_str);
uuid=new UUID(0, tmp);
代码示例来源:origin: apache/geode
@Test
public void testCompareToIsSame() {
GMSMember member = new GMSMember();
UUID uuid = new UUID(0, 0);
member.setUUID(uuid);
assertEquals(0, member.compareTo(member));
}
代码示例来源:origin: apache/geode
@Test
public void testGetUUIDReturnsNullWhenUUIDIs0() {
GMSMember member = new GMSMember();
UUID uuid = new UUID(0, 0);
member.setUUID(uuid);
assertNull(member.getUUID());
}
代码示例来源:origin: apache/geode
@Test
public void testGetUUID() {
GMSMember member = new GMSMember();
UUID uuid = new UUID(1, 1);
member.setUUID(uuid);
assertNotNull(member.getUUID());
}
代码示例来源:origin: apache/geode
members.add(new UUID(0, 0));// TODO open a JGroups JIRA for GEODE-3034
View jgv = new View(vid, members);
this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv));
代码示例来源:origin: wildfly/wildfly
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 if(Util.isFlagSet(flags, Address.IP_ADDR_UUID)) {
addr=new IpAddressUUID();
addr.readFrom(in);
}
else {
addr=readOtherAddress(in);
}
return addr;
}
代码示例来源:origin: org.apache.geode/gemfire-core
/**
* return the jgroups logical address for this member,
* if it's been established
*/
public UUID getUUID() {
if (this.uuidLSBs == 0 && this.uuidMSBs == 0) {
return null;
}
return new UUID(this.uuidMSBs, this.uuidLSBs);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public UUID copy() {
return new UUID(mostSigBits, leastSigBits);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public Address generateAddress() {
if(first) {
first=false;
return new UUID(0, initial_val);
}
return Util.createRandomAddress();
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* 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(16));
}
代码示例来源:origin: org.infinispan/infinispan-core
private List<Address> createAddresses(int numNodes) {
Random r = new Random();
List<Address> addresses = new ArrayList<Address>(numNodes);
while (addresses.size() < numNodes)
addresses.add(new JGroupsAddress(new org.jgroups.util.UUID(r.nextLong(), r.nextLong())));
return addresses;
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testJGroupsAddress() {
cache.put("key", new JGroupsAddress(new UUID()));
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
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.add(System.nanoTime() - start);
forward_to_local_mbr.increment();
}
}
内容来源于网络,如有侵权,请联系作者删除!