/** 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; }
/** * Create a ClientLeaseMapWrapper object that will hold * the specified client Lease. * @param wrapper a wrapper for the lease that wants to be renewed * @param duration the duration to associate with wrapper * @throws IllegalArgumentException if wrapper is deformed */ ClientLeaseMapWrapper(ClientLeaseWrapper wrapper, long duration) { final Lease clientLease = wrapper.getClientLease(); if (clientLease == null) { throw new IllegalArgumentException("Wrapper cannot be deformed"); } LeaseMap leaseMap = clientLease.createLeaseMap(duration); if (clientLease instanceof RemoteMethodControl && leaseMap instanceof RemoteMethodControl) { leaseMap = (LeaseMap) ((RemoteMethodControl) leaseMap).setConstraints( ConstrainableProxyUtil.translateConstraints( ((RemoteMethodControl) clientLease).getConstraints(), leaseToLeaseMapMethods)); } clientLeaseMap = leaseMap; wrapperMap.put(clientLease, wrapper); example = wrapper; }