public Entry(Lease lease, long expiration, long renewDuration, long renewalRTT, LeaseListener listener) { this.endTime = lease.getExpiration(); this.lease = lease; this.expiration = expiration; this.renewDuration = renewDuration; this.listener = listener; this.renewalRTT = renewalRTT; id = cnt++; }
public int size() { return clientLeaseMap.size(); }
public void clear() { wrapperMap.clear(); clientLeaseMap.clear(); } }
/** * Find a lease entry, throw exception if not found or expired * normally */ private Entry findEntry(Lease lease) throws UnknownLeaseException { Entry e = findEntryDo(lease); if (e != null && (e.renew < e.endTime || System.currentTimeMillis() < e.endTime)) { return e; } throw new UnknownLeaseException(); }
@Override public LeaseMap createLeaseMap(long duration) { LeaseMap leaseMap = new SpaceLeaseMap(_spaceProxy, false); leaseMap.put(this, duration); return leaseMap; }
/** Requests the cancellation of the lease on the * <code>ServiceRegistration</code> that is referenced in the * <code>proxyReg</code> data structure. */ @Override public void run() { logger.finest("JoinManager --> DiscardProxyTask started"); Lease svcLease = proxyReg != null ? proxyReg.serviceLease : null; if( svcLease != null ) { try { svcLease.cancel(); } catch (Exception e) { /*ignore*/ } }//endif logger.finest("JoinManager - DiscardProxyTask completed"); }//end run
public void remove() { // Use last to remove the data from the clientLeaseMap clientLeaseMap.remove(last); // use iter.remove() to remove from wrapperMap so we don't // get a concurrent access exception iter.remove(); } }
public Object get(Object key) { final Lease cl = checkKey(key); return clientLeaseMap.get(cl); }
public boolean containsKey(Object key) { final Lease cl = checkKey(key); return clientLeaseMap.containsKey(cl); }
public boolean containsValue(Object value) { checkValue(value); return clientLeaseMap.containsValue(value); }
@Override public boolean equals(Object o) { if (o instanceof LeaseMap) { LeaseMap lm = (LeaseMap) o; return entrySet().equals(lm.entrySet()); } return false; }
/** * Used to renew the iterator's lease for an additional period of time, specified in * milliseconds. This duration is not added to the original lease, but is used to determine a * new expiration time for the existing lease. If the renewal is granted this is reflected in * value returned by getExpiration. If the renewal fails, the lease is left intact for the same * duration that was in force prior to the call to renew. <p> An expired iterator is an * <em>invalidated</em> iterator and will have no more entities added to it. Subsequent calls to * <code>next</code> on this iterator will always return <code>null</code>. * * @param duration the requested duration in milliseconds * @throws IllegalArgumentException if invalid lease expiration time * @throws LeaseDeniedException if the iterator's lease has already expired */ public void renew(long duration) throws IllegalArgumentException, LeaseDeniedException { if (_leasedIterator.isTerminated()) throw new LeaseDeniedException("Lease has already expired or been cancelled."); _leasedIterator.renew(duration); }
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(); } }
public Entry(Lease lease, long expiration, long renewDuration, LeaseListener listener, long renewalRTT) { this.endTime = lease.getExpiration(); this.lease = lease; this.expiration = expiration; this.renewDuration = renewDuration; this.listener = listener; this.renewalRTT = renewalRTT; id = cnt++; }
public Object setValue(Object value) { checkValue(value); return clientLeaseMap.put(key.getClientLease(), value); }
public void clear() { clientLeaseMap.clear(); wrapperMap.clear(); }
public Object remove(Object key) { final Lease cl = checkKey(key); wrapperMap.remove(cl); return clientLeaseMap.remove(cl); }
public Object getValue() { return clientLeaseMap.get(key.getClientLease()); }
/** * Find a lease entry, throw exception if not found or expired normally */ private Entry findEntry(Lease lease) throws UnknownLeaseException { Entry e = findEntryDo(lease); if (e != null && (e.renew < e.endTime || SystemTime.timeMillis() < e.endTime)) { return e; } throw new UnknownLeaseException(); }
public long getExpiration() { final Lease cl = getClientLease(); if (cl == null) { // $$$ Why is this synchronized? synchronized (this) { return clientLeaseExpiration; } } else { return cl.getExpiration(); } }