private static class LeaseRenewalManager.Entry extends Object implements Comparable
Modifier and Type | Field and Description |
---|---|
long |
actualRenew
Actual time to renew, given concurrency limitations
|
private static long |
cnt |
long |
endTime
Current actual expiration
|
Throwable |
ex
Renewal exception, or null
|
long |
expiration
Desired expiration
|
long |
id
Unique id
|
Lease |
lease
The lease
|
LeaseListener |
listener
The listener, or null
|
long |
renew
The next time we have to do something with this lease.
|
private long |
renewalRTT |
long |
renewDuration
Renew duration
|
Constructor and Description |
---|
Entry(Lease lease,
long expiration,
long renewDuration,
long renewalRTT,
LeaseListener listener) |
Entry(long renew,
long renewalRTT)
Create a fake entry for tailMap
|
Modifier and Type | Method and Description |
---|---|
void |
calcRenew(long now)
Calculate the renew time for the lease entry
|
boolean |
canBatch(LeaseRenewalManager.Entry e)
Returns true if the renewal of this lease can be batched with
the (earlier) renewal of the given lease.
|
int |
compareTo(Object obj)
Sort by decreasing renew time, secondary sort by decreasing id
|
void |
delayRenew()
Calculate a new renew time due to an indefinite exception
|
DesiredExpirationListener |
desiredExpirationListener()
Return the DesiredExpirationListener associated with this
lease, or null if there is none.
|
long |
getRenewDuration(long now)
If the renewDuration is ANY, return ANY, otherwise return the
minimum of the renewDuration and the time remaining until the
desired expiration.
|
boolean |
renewalsDone()
Return true if the actual expiration is greater than or equal
to the desired expiration (e.g. we don't need to renew this
lease any more.
|
private static boolean |
sameConstraints(Lease l1,
Lease l2)
Returns true if the two leases both implement RemoteMethodControl
and have the same constraints for Lease methods, or both don't
implement RemoteMethodControl, else returns false.
|
private static long cnt
public final long id
public final Lease lease
public long expiration
public long renewDuration
public final LeaseListener listener
public long endTime
private final long renewalRTT
public long renew
public long actualRenew
public Throwable ex
public Entry(Lease lease, long expiration, long renewDuration, long renewalRTT, LeaseListener listener)
public Entry(long renew, long renewalRTT)
public long getRenewDuration(long now)
public void calcRenew(long now)
public void delayRenew()
public int compareTo(Object obj)
compareTo
in interface Comparable
public boolean canBatch(LeaseRenewalManager.Entry e)
First checks that both leases require renewal, have the same client constraints, and can be batched. Then enforces additional requirements to avoid renewing the lease too much more often than necessary.
One of the following must be true:
In addition, one of the following must be true:
private static boolean sameConstraints(Lease l1, Lease l2)
public DesiredExpirationListener desiredExpirationListener()
public boolean renewalsDone()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.