throws UnknownLeaseException, LeaseDeniedException
{
leaseLogger.entering("OutriggerServerImpl","renew");
LeasedResource resource;
LeasePeriodPolicy policy;
if (null != (resource = contents.getLeasedResource(cookie)))
policy = entryLeasePolicy;
else if (null !=
(resource = (LeasedResource)eventRegistrations.get(cookie)))
policy = eventLeasePolicy;
else if (null !=
(resource = (LeasedResource)contentsQueries.get(cookie)))
policy = contentsLeasePolicy;
else
throw throwNewUnknownLeaseException(cookie);
synchronized (resource) {
if (resource.getExpiration() <= System.currentTimeMillis()) {
// Lease has expired, don't renew
throw throwNewUnknownLeaseException(cookie);
}
// No one can expire the lease, so it is safe to update.
final LeasePeriodPolicy.Result r =
policy.renew(resource, extension);
if (log != null)
log.renewOp((Uuid)cookie, r.expiration);
resource.setExpiration(r.expiration);