net.jini.id.Uuid.getLeastSignificantBits()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(194)

本文整理了Java中net.jini.id.Uuid.getLeastSignificantBits()方法的一些代码示例,展示了Uuid.getLeastSignificantBits()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Uuid.getLeastSignificantBits()方法的具体详情如下:
包路径:net.jini.id.Uuid
类名称:Uuid
方法名:getLeastSignificantBits

Uuid.getLeastSignificantBits介绍

[英]Returns the least significant 64 bits of this Uuid's 128-bit value.
[中]返回此Uuid的128位值的最低有效64位。

代码示例

代码示例来源:origin: xap/xap

private Long getLeaseTid(Uuid uuid) {
  // Extract the txn id from the lower bits of the uuid
  return new Long(uuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

public void writeExternal(ObjectOutput out) throws IOException {
  if (backend != null) {
    out.writeBoolean(true);
    out.writeObject(backend);
  } else {
    out.writeBoolean(false);
  }
  out.writeLong(proxyID.getMostSignificantBits());
  out.writeLong(proxyID.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

private Uuid createLeaseUuid(long txnId) {
  return new Uuid(topUuid.getLeastSignificantBits(),
      txnId);
    /*return UuidFactory.create(
    topUuid.getLeastSignificantBits(),
    txnId);*/
}

代码示例来源:origin: xap/xap

/**
 * Proxies for servers with the same <code>proxyID</code> are considered equal.
 */
@Override
public boolean equals(Object o) {
  //return ReferentUuids.compare(this,o);
  if (this == o)
    return true;
  if (o instanceof TxnMgrProxy) {
    TxnMgrProxy other = (TxnMgrProxy) o;
    return proxyID.getLeastSignificantBits() == other.proxyID.getLeastSignificantBits() &&
        proxyID.getMostSignificantBits() == other.proxyID.getMostSignificantBits();
  } else
    return false;
}

代码示例来源:origin: au.net.zeus.jgdms.mercury/mercury-service

/**
 * Primary sort by leaseExpiration, secondary by leaseID.  The
 * secondary sort is immaterial, except to ensure a total order
 * (required by TreeMap).
 */
public synchronized int compareTo(Object obj) {
  ServiceRegistration reg = (ServiceRegistration)obj;
  if (this == reg)
    return 0;
  if ( expiration < reg.expiration ||
     (expiration == reg.expiration &&
     (   (cookie.getMostSignificantBits() < 
     reg.cookie.getMostSignificantBits())
     && (cookie.getLeastSignificantBits() < 
     reg.cookie.getLeastSignificantBits()) ) ))
    return -1;
  return 1;
}

代码示例来源:origin: au.net.zeus.jgdms.norm/norm-service

@Override
public ServiceID serviceID() throws IOException {
return new ServiceID(serverUuid.getMostSignificantBits(),
      serverUuid.getLeastSignificantBits());
}

代码示例来源:origin: au.net.zeus.jgdms.mercury/mercury-service

@Override
public ServiceID serviceID() throws IOException {
return new ServiceID(serviceID.getMostSignificantBits(),
  serviceID.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

public ServiceID getServiceId() {
  if (_proxyId == null)
    return null;
  return new ServiceID(_proxyId.getMostSignificantBits(),
      _proxyId.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

private void verifyLeaseUuid(Uuid uuid) throws UnknownLeaseException {
/*
 * Note: Lease Uuid contains
 * - Most Sig => the least sig bits of topUuid
 * - Least Sig => the txn id
 */
  // Check to if this server granted the resource
  if (uuid.getMostSignificantBits() !=
      topUuid.getLeastSignificantBits()) {
    throw new UnknownLeaseException();
  }
}

代码示例来源:origin: au.net.zeus.jgdms/jgdms-lib-dl

public int compareTo(LeaseEntry<K> o) {
  if (identity instanceof Uuid && o.identity instanceof Uuid){
    long mine = ((Uuid) identity).getLeastSignificantBits();
    long his = ((Uuid) o.identity).getLeastSignificantBits();
    if ( mine < his) return -1;
    if ( mine > his) return 1;
    if ( mine == his){
      mine = ((Uuid) identity).getMostSignificantBits();
      his = ((Uuid) o.identity).getMostSignificantBits();
      if ( mine < his) return -1;
      if ( mine > his) return 1;
      return 0;
    }
  }
  int myHash = hashCode();
  int hisHash = o.hashCode();
  if (myHash < hisHash) return -1;
  if (myHash > hisHash) return 1;
  return 0;
}

代码示例来源:origin: xap/xap

/**
 * Generate a new service ID
 */
private ServiceID newServiceID() {
  Uuid uuid = serviceIdGenerator.generate();
  return new ServiceID(
      uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

/**
 * Generate a new service ID
 */
private ServiceID newServiceID
() {
  Uuid uuid = serviceIdGenerator.generate();
  return new ServiceID(
      uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

public static ServiceID getServiceID(ReferentUuid service) {
  Uuid uuid = service.getReferentUuid();
  return new ServiceID(uuid.getMostSignificantBits(),
      uuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

/**
 * Primary sort by leaseExpiration, secondary by leaseID.  The secondary sort is immaterial,
 * except to ensure a total order (required by TreeMap).
 */
public int compareTo(SvcReg reg) {
  if (this == reg)
    return 0;
  int i = compare(leaseExpiration, reg.leaseExpiration);
  if (i != 0) {
    return i;
  }
  i = compare(leaseID.getMostSignificantBits(),
      reg.leaseID.getMostSignificantBits());
  if (i != 0) {
    return i;
  }
  return compare(leaseID.getLeastSignificantBits(),
      reg.leaseID.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

/**
 * Primary sort by leaseExpiration, secondary by leaseID.  The secondary sort is immaterial,
 * except to ensure a total order (required by TreeMap).
 */
public int compareTo(Object obj) {
  SvcRegExpirationKey reg = (SvcRegExpirationKey) obj;
  if (this == reg)
    return 0;
  int i = compare(leaseExpiration, reg.leaseExpiration);
  if (i != 0) {
    return i;
  }
  i = compare(svcReg.leaseID.getMostSignificantBits(),
      reg.svcReg.leaseID.getMostSignificantBits());
  if (i != 0) {
    return i;
  }
  return compare(svcReg.leaseID.getLeastSignificantBits(),
      reg.svcReg.leaseID.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

/**
 * Primary sort by leaseExpiration, secondary by leaseID.  The secondary sort is immaterial,
 * except to ensure a total order (required by TreeMap).
 */
public int compareTo(Object obj) {
  if (obj == null) {
    return -1;
  }
  SvcReg reg = (SvcReg) obj;
  if (this == reg)
    return 0;
  int i = compare(leaseExpiration, reg.leaseExpiration);
  if (i != 0) {
    return i;
  }
  i = compare(leaseID.getMostSignificantBits(),
      reg.leaseID.getMostSignificantBits());
  if (i != 0) {
    return i;
  }
  return compare(leaseID.getLeastSignificantBits(),
      reg.leaseID.getLeastSignificantBits());
}

代码示例来源:origin: au.net.zeus.jgdms/jgdms-platform

/**        
 * Returns a <code>ServiceID</code> constructed from a 128-bit value
 * represented by a string.  The supplied string representation must 
 * be in the format defined by 
 * {@link net.jini.core.lookup.ServiceID#toString ServiceID.toString}, 
 * except that uppercase hexadecimal digits are allowed.
 *
 * @param s the string representation to create the <code>ServiceID</code> 
 * with    
 * @return a <code>ServiceID</code> with the value represented by the
 * given string
 * @throws IllegalArgumentException if the supplied string
 * representation does not conform to the specified format  
 * @throws NullPointerException if <code>s</code> is
 * <code>null</code>
 **/    
public static ServiceID createServiceID(String s) {
Uuid uuid = UuidFactory.create(s);
return new ServiceID(uuid.getMostSignificantBits(), 
       uuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

public JSpaceProxyWrapper(IJSpace spaceProxy) {
  proxyObject = spaceProxy;
  proxyName = spaceProxy.getName();
  Uuid spaceUuid = spaceProxy.getReferentUuid();
  _serviceID = new ServiceID(spaceUuid.getMostSignificantBits(), spaceUuid.getLeastSignificantBits());
}

代码示例来源:origin: xap/xap

ServiceID serviceId = new ServiceID(
    _service.getUuid().getMostSignificantBits(),
    _service.getUuid().getLeastSignificantBits());

代码示例来源:origin: xap/xap

private ElectionEntry(Object service, ServiceTemplate srvTemplate) {
  /* constructor to make compiler happy :) */
  super(null, null, null);
  this.service = service;
  if (service instanceof ReferentUuid) {
    long mostSignBits = ((ReferentUuid) service).getReferentUuid().getMostSignificantBits();
    long leastSignBits = ((ReferentUuid) service).getReferentUuid().getLeastSignificantBits();
    _serviceID = new ServiceID(mostSignBits, leastSignBits);
  }
  /* keep the reference so that we can change the desired state on demand */
  _actState = new ActiveElectionState();
  /* Attribute set templates to match, or <tt>null</tt>. */
  this.attributeSetTemplates = LookupAttributes.add(srvTemplate.attributeSetTemplates, new Entry[]{_actState});
  /* Service types to match */
  this.serviceTypes = srvTemplate.serviceTypes;
}// constructor

相关文章