@Override public LeaseMap createLeaseMap(long duration) { LeaseMap leaseMap = new SpaceLeaseMap(_spaceProxy, false); leaseMap.put(this, duration); return leaseMap; }
public Object setValue(Object value) { checkValue(value); return clientLeaseMap.put(key.getClientLease(), value); }
public Object put(Object key, Object value) { final Lease cl = checkKey(key); checkValue(value); // At this point we know key is a ClientLeaseWrapper /* * Since there is a 1:1 mapping between wrappers and client * leases, and, once we get going, we never have two wrapper * objects that != but are .equals(), if key is already in this * map, then wrapperMap.put() will replace the existing copy of * key with a == copy. This gives us the key non-replacement * semantics Map.put() should have. */ wrapperMap.put(cl, key); return clientLeaseMap.put(cl, value); }
/** Create a LeaseMap for batch renewal */ private static LeaseMap createBatchLeaseMap(List bList, long now) { Iterator iter = bList.iterator(); Entry e = (Entry) iter.next(); LeaseMap batchLeaseMap = e.lease.createLeaseMap(e.getRenewDuration(now)); if (e.lease instanceof RemoteMethodControl && batchLeaseMap instanceof RemoteMethodControl) { batchLeaseMap = (LeaseMap) ((RemoteMethodControl) batchLeaseMap).setConstraints( ConstrainableProxyUtil.translateConstraints( ((RemoteMethodControl) e.lease).getConstraints(), leaseToLeaseMapMethods)); } while (iter.hasNext()) { e = (Entry) iter.next(); batchLeaseMap.put(e.lease, Long.valueOf(e.getRenewDuration(now))); } return batchLeaseMap; }
/** * Create a LeaseMap for batch renewal */ private static LeaseMap createBatchLeaseMap(List<Entry> bList, long now) { Iterator<Entry> iter = bList.iterator(); Entry e = iter.next(); LeaseMap batchLeaseMap = e.lease.createLeaseMap(e.getRenewDuration(now)); if (e.lease instanceof RemoteMethodControl && batchLeaseMap instanceof RemoteMethodControl) { batchLeaseMap = (LeaseMap) ((RemoteMethodControl) batchLeaseMap).setConstraints( ConstrainableProxyUtil.translateConstraints( ((RemoteMethodControl) e.lease).getConstraints(), leaseToLeaseMapMethods)); } while (iter.hasNext()) { e = iter.next(); batchLeaseMap.put(e.lease, new Long(e.getRenewDuration(now))); } return batchLeaseMap; }