HBASE-2077 NullPointerException with an open scanner that expired causing

an immediate region server shutdown (JD's fix)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@916070 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2010-02-25 00:59:34 +00:00
parent 961e65362e
commit 6c100b6de3
1 changed files with 21 additions and 7 deletions

View File

@ -90,14 +90,19 @@ public class Leases extends Thread {
if (lease == null) { if (lease == null) {
continue; continue;
} }
// A lease expired. Run the expired code before removing from queue
// since its presence in queue is used to see if lease exists still.
if (lease.getListener() == null) {
LOG.error("lease listener is null for lease " + lease.getLeaseName());
} else {
lease.getListener().leaseExpired();
}
synchronized (leaseQueue) { synchronized (leaseQueue) {
if (lease.getExpirationTime() <= System.currentTimeMillis()) {
leaseQueue.add(lease);
continue;
}
// A lease expired. Run the expired code before removing from queue
// since its presence in queue is used to see if lease exists still.
if (lease.getListener() == null) {
LOG.error("lease listener is null for lease " + lease.getLeaseName());
} else {
lease.getListener().leaseExpired();
}
leases.remove(lease.getLeaseName()); leases.remove(lease.getLeaseName());
} }
} }
@ -268,5 +273,14 @@ public class Leases extends Thread {
public void setExpirationTime(long expirationTime) { public void setExpirationTime(long expirationTime) {
this.expirationTime = expirationTime; this.expirationTime = expirationTime;
} }
/**
* Get the expiration time for that lease
* @return expiration time
*/
public long getExpirationTime() {
return this.expirationTime;
}
} }
} }