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

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

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

Uuid.equals介绍

[英]Compares the specified object with this Uuid for equality. This method returns true if and only if the specified object is a Uuid instance with the same 128-bit value as this one.
[中]将指定对象与此Uuid进行相等性比较。当且仅当指定的对象是与此对象具有相同128位值的Uuid实例时,此方法返回true

代码示例

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

@Override
public boolean equals(Object o){
if (this == o) return true;
if (!(o instanceof ServiceRegistration)) return false;
ServiceRegistration that = (ServiceRegistration) o;
if (!cookie.equals(that.cookie)) return false;
return (expiration == that.expiration);
}

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

public boolean canBatch(Lease lease) {
if (lease instanceof LandlordLease) {
   return landlordUuid.equals(((LandlordLease)lease).landlordUuid);
}
    return false;
}

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

public boolean canBatch(Lease lease) {
  if (lease instanceof LandlordLease) {
    return landlordUuid.equals(((LandlordLease) lease).landlordUuid);
  }
  return false;
}

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

/**
 * Examines the input parameter to determine if that parameter, along
 * with the current lease (the current instance of this class), can
 * be batched in a <code>LeaseMap</code>.
 * <p>
 * For this implementation of the service, two leases can be batched
 * (placed in the same service-specific instance of <code>LeaseMap</code>)
 * if those leases satisfy the following conditions:
 * </p><ul>
 *    <li> the leases are the same type; that is, the leases are both
 *         instances of the same, service-specific <code>Lease</code>
 *         implementation
 *    <li> the leases were granted by the same backend server
 *    </ul>     
 * @param lease reference to the <code>Lease</code> object that this
 *              method examines for batching compatibility with the
 *              the current current instance of this class
 *                      
 * @return <code>true</code> if the input parameter is compatible for
 *         batching with the current current instance of this class,
 *         <code>false</code> otherwise
 *
 * @see net.jini.core.lease.Lease#canBatch
 */
public boolean canBatch(Lease lease) {
  return (    (lease instanceof FiddlerLease)
       && (serverID.equals(((FiddlerLease)lease).serverID))  );
}//end FiddlerLease.canBatch

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

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (getClass() != obj.getClass())
    return false;
  AbstractTransactionUniqueId other = (AbstractTransactionUniqueId) obj;
  if (_transactionManagerId == null) {
    if (other._transactionManagerId != null)
      return false;
  } else if (!_transactionManagerId.equals(other._transactionManagerId))
    return false;
  return true;
}

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

/**
 * Renew the service lease for an absolute expiration time.
 */
private void renewServiceLeaseAbs(ServiceID serviceID,
                 Uuid leaseID,
                 long renewExpiration) {
  SvcReg reg = (SvcReg) serviceByID.get(serviceID);
  if (reg == null || !reg.leaseID.equals(leaseID))
    return;
/* force a re-sort: must remove before changing, then reinsert */
  serviceByTime.remove(reg);
  reg.leaseExpiration = renewExpiration;
  serviceByTime.put(reg, reg);
}

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

/**
 * Renew the event lease for an absolute expiration time.
 */
private void renewEventLeaseAbs(long eventID,
                Uuid leaseID,
                long renewExpiration) {
  EventReg reg = (EventReg) eventByID.get(new Long(eventID));
  if (reg == null || !reg.leaseID.equals(leaseID))
    return;
/* force a re-sort: must remove before changing, then reinsert */
  eventByTime.remove(reg);
  reg.leaseExpiration = renewExpiration;
  eventByTime.put(reg, reg);
}

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

public boolean canContainKey(Object key) {
if (key instanceof LandlordLease) {
   return landlordUuid.equals(((LandlordLease)key).landlordUuid());
}
return false;
}

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

public boolean canContainKey(Object key) {
  if (key instanceof LandlordLease) {
    return landlordUuid.equals(((LandlordLease) key).landlordUuid());
  }
  return false;
}

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

public void setConnected(IReplicationConnectionProxy proxy, T tag,
             String endPointLookupName, Uuid proxyId) {
  boolean newTarget = _proxyId == null ? true : !_proxyId.equals(proxyId);
  synchronized (getStateLock()) {
    if (_connectionState == ConnectionState.CONNECTED)
      return;
    _timeOfDisconnection = null;
    _connectionProxy = proxy;
    _tag = tag;
    _endPointLookupName = endPointLookupName;
    _proxyId = proxyId;
    _connectionState = ConnectionState.CONNECTED;
    if (_specificLogger.isLoggable(Level.INFO))
      _specificLogger.info("Connection state updated to 'CONNECTED', Lookup name: "+endPointLookupName);
    addPendingEvent(newTarget ? StateChangedEvent.CONNECTED_NEW
        : StateChangedEvent.CONNECTED_OLD);
  }
}

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

private long renewEventLeaseInt(long eventID,
                Uuid leaseID,
                long renewDuration,
                long now)
    throws UnknownLeaseException {
  if (renewDuration == Lease.ANY)
    renewDuration = maxEventLease;
  else if (renewDuration < 0)
    throw new IllegalArgumentException("negative lease duration");
  EventReg reg = (EventReg) eventByID.get(new Long(eventID));
  if (reg == null ||
      !reg.leaseID.equals(leaseID) ||
      reg.leaseExpiration <= now)
    throw new UnknownLeaseException();
  if (renewDuration > maxEventLease &&
      renewDuration > reg.leaseExpiration - now)
    renewDuration = Math.max(reg.leaseExpiration - now, maxEventLease);
  long renewExpiration = now + renewDuration;
/* force a re-sort: must remove before changing, then reinsert */
  eventByTime.remove(reg);
  reg.leaseExpiration = renewExpiration;
  eventByTime.put(reg, reg);
/* see if the expire thread needs to wake up earlier */
  if (renewExpiration < minEventExpiration) {
    minEventExpiration = renewExpiration;
    concurrentObj.waiterNotify(eventNotifier);
  }
  return renewExpiration;
}

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

private void validateIterator(Uuid regId, Uuid iterId) 
  throws InvalidIteratorException, ThrowThis
{
  // Note: the following method will throw a ThrowThis exception
  // if the registration is invalid (i.e. expired or non-existent)
  ServiceRegistration reg = getServiceRegistration(regId); 
  Uuid validIterId = reg.getRemoteEventIteratorID();
  if (!iterId.equals(validIterId)) {
  if(DELIVERY_LOGGER.isLoggable(Level.FINEST)) {
      DELIVERY_LOGGER.log(Level.FINEST, 
      "Provided iterator id " + iterId + 
        " doesn't match current valid iterator id " +
        validIterId);
    }
    throw new InvalidIteratorException("Iterator is not valid");
  }        
}

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

/**
 * The code that does the real work of cancelServiceLease.
 */
private void cancelServiceLeaseDo(ServiceID serviceID, Uuid leaseID) throws UnknownLeaseException {
  if (serviceID.equals(myServiceID))
    throw new SecurityException("privileged service id");
  long now = SystemTime.timeMillis();
  SvcReg reg = serviceByID.get(serviceID);
  if (reg == null ||
      !reg.leaseID.equals(leaseID) ||
      reg.leaseExpiration <= now)
    throw new UnknownLeaseException();
  deleteService(null, reg, now);
}

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

/**
 * The code that does the real work of cancelServiceLease.
 */
private void cancelServiceLeaseDo(ServiceID serviceID, Uuid leaseID)
    throws UnknownLeaseException {
  if (serviceID.equals(myServiceID))
    throw new SecurityException("privileged service id");
  long now = System.currentTimeMillis();
  SvcReg reg = (SvcReg) serviceByID.get(serviceID);
  if (reg == null ||
      !reg.leaseID.equals(leaseID) ||
      reg.leaseExpiration <= now)
    throw new UnknownLeaseException();
  deleteService(reg, now);
/* wake up thread if this might be the (only) earliest time */
  if (reg.leaseExpiration == minSvcExpiration)
    concurrentObj.waiterNotify(serviceNotifier);
}

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

/**
   * Returns <code>true</code> if the two passed objects are non-<code>null</code>, implement
   * <code>ReferentUuid</code> and their <code>getReferentUuid</code> methods return equivalent
   * <code>Uuid</code>s, or if they are both <code>null</code>. Otherwise returns
   * <code>false</code>.
   *
   * @param o1 The first object to compare.
   * @param o2 The second object to compare.
   * @return <code>true</code> if <code>o1</code> and <code>o2</code> implement
   * <code>ReferentUuid</code> and their <code>getReferentUuid</code> methods return equivalent
   * <code>Uuid</code>s, or if <code>o1</code> and <code>o2</code> are both <code>null</code>.
   */
  public static boolean compare(Object o1, Object o2) {
    if (o1 == null || o2 == null)
      return o1 == o2; // return true if both null

    if (!(o1 instanceof ReferentUuid))
      return false;

    if (!(o2 instanceof ReferentUuid))
      return false;

    return ((ReferentUuid) o1).getReferentUuid().equals(
        ((ReferentUuid) o2).getReferentUuid());
  }
}

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

/**
   * Returns <code>true</code> if the two passed objects are
   * non-<code>null</code>, implement <code>ReferentUuid</code> and
   * their <code>getReferentUuid</code> methods return equivalent
   * <code>Uuid</code>s, or if they are both <code>null</code>.
   * Otherwise returns <code>false</code>.
   * @param o1 The first object to compare.
   * @param o2 The second object to compare.
   * @return <code>true</code> if <code>o1</code> and <code>o2</code>
   *         implement <code>ReferentUuid</code> and their
   *         <code>getReferentUuid</code> methods return equivalent 
   *         <code>Uuid</code>s, or if <code>o1</code> and <code>o2</code>
   *         are both <code>null</code>.
   */
  public static boolean compare(Object o1, Object o2) {
  if (o1 == null || o2 == null)
    return o1 == o2; // return true if both null

  if (!(o1 instanceof ReferentUuid))
    return false;

  if (!(o2 instanceof ReferentUuid))
    return false;

  return ((ReferentUuid)o1).getReferentUuid().equals(
    ((ReferentUuid)o2).getReferentUuid());
  }
}

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

if (reg == null)
  throw new UnknownLeaseException("trying to renew unknown lease,  event id: " + eventID);
if (!reg.leaseID.equals(leaseID))
  throw new UnknownLeaseException("Lease id: " + leaseID + " does not match event: " +
      eventID + " lease id: " + reg.leaseID);

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

/**
 * The code that does the real work of setAttributes. Replace all attributes of item with
 * attrSets, updating serviceByAttr as necessary, incrementing the number of EntryClass
 * instances, and updating entryClasses as necessary.
 */
private void setAttributesDo(ServiceID serviceID,
               Uuid leaseID,
               EntryRep[] attrSets)
    throws UnknownLeaseException {
  if (attrSets == null)
    attrSets = emptyAttrs;
  else
    attrSets = (EntryRep[]) removeDups(attrSets);
  long now = System.currentTimeMillis();
  SvcReg reg = (SvcReg) serviceByID.get(serviceID);
  if (reg == null ||
      !reg.leaseID.equals(leaseID) ||
      reg.leaseExpiration <= now)
    throw new UnknownLeaseException();
  Item pre = (Item) reg.item.clone();
  EntryRep[] entries = reg.item.attributeSets;
  for (int i = entries.length; --i >= 0; ) {
    deleteAttrs(reg, entries[i], false);
  }
  reg.item.attributeSets = attrSets;
  for (int i = attrSets.length; --i >= 0; ) {
    addAttrs(reg, attrSets[i]);
  }
  generateEvents(pre, reg.item, now);
}

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

/**
 * provides the consistent cross VM proxy equals implementation by {@link Uuid}
 */
@Override
public boolean equals(Object obj) {
  if (obj == this)
    return true;
  if (!(obj instanceof AbstractDirectSpaceProxy))
    return false;
  AbstractDirectSpaceProxy other = (AbstractDirectSpaceProxy) obj;
  return this.getProxySettings().getUuid().equals(other.getProxySettings().getUuid()) &&
      this.isClustered() == other.isClustered();
}

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

/**
 * The code that does the real work of setAttributes. Replace all attributes of item with
 * attrSets, updating serviceByAttr as necessary, incrementing the number of EntryClass
 * instances, and updating entryClasses as necessary.
 */
private void setAttributesDo(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws UnknownLeaseException {
  if (attrSets == null)
    attrSets = emptyAttrs;
  else
    attrSets = (EntryRep[]) removeDups(attrSets);
  long now = SystemTime.timeMillis();
  SvcReg reg = serviceByID.get(serviceID);
  if (reg == null ||
      !reg.leaseID.equals(leaseID) ||
      reg.leaseExpiration <= now)
    throw new UnknownLeaseException();
  Item pre = (Item) reg.item.clone();
  EntryRep[] entries = reg.item.attributeSets;
  for (int i = entries.length; --i >= 0; ) {
    deleteAttrs(reg, entries[i], false);
  }
  reg.item.attributeSets = attrSets;
  for (int i = attrSets.length; --i >= 0; ) {
    addAttrs(reg, attrSets[i]);
  }
  refreshServiceFromLookupCache(reg.item, false);
  generateEvents(pre, reg.item, now);
}

相关文章