|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.psepr.jClient.LeaseManager
org.psepr.jClient.SimpleLeaseManager
public class SimpleLeaseManager
The simple lease manager tries to manage a lease of a fixed duration and, when the end of the lease nears, to request a new lease of that duration again. The effect is to keep the lease active until this.release() is called.
The use of this class is:
LeaseManager myLM = new SimpleLeaseManager(channelName, leaseDurationInSeconds); PsEPRLease myLease = pConn.getLease(channelName, payloadParser, eventReceiver, myLM); .... pConn.releaseLease(myLease);There are also calls in PsEPRConnection.getLease that hide the use of SimpleLeaseManager with a call that just specifies a duration:
PsEPRLease myLease = pConn.getLease(channelName, payloadParser, eventReceiver, leaseDurationInSeconds); ... pConn.releaseLease(myLease);
This lease manager has several states:
A timeout routine is set while a lease is pending, active or renegotiating. If LEASE_ACTIVE, the timeout is LongTimeoutPercent/100 th of the granted time period and it causes this to renegotiate for a longer lease. If LEASE_PENDING or LEASE_RENEGOTIATING, the retry counter is counted down (starts at MaxRetries and counts down to zero) and the lease request is retried. In this case, the timeout period is ShortTimeoutPercent/100 th of the requested lease length.
| Constructor Summary | |
|---|---|
SimpleLeaseManager()
|
|
SimpleLeaseManager(PsEPRConnection pConn,
java.lang.String chan,
java.lang.String type)
|
|
SimpleLeaseManager(PsEPRConnection pConn,
java.lang.String chan,
java.lang.String type,
long interval)
|
|
| Method Summary | |
|---|---|
void |
forceRenegotiation()
Called to make the lease ask for permission again. |
java.lang.String |
getChannel()
|
boolean |
getLeaseActive()
|
long |
getLeaseGranted()
|
java.lang.String |
getLeaseID()
Return the unique identifier for the lease |
int |
getLeaseState()
|
java.lang.String |
getLeaseStateName()
|
long |
getLeaseWindow()
|
int |
getLongTimeoutPercent()
|
long |
getLongTimeoutPeriod()
|
int |
getMaxRetries()
|
int |
getRetriesRemaining()
|
int |
getShortTimeoutPeriod()
|
java.lang.String |
getType()
|
boolean |
receiveEvent(PsEPREvent pE)
Called to see if I want to process this event. |
void |
release()
Release our lease. |
void |
setChannel(java.lang.String chan)
|
void |
setLeaseGranted(long lg)
|
void |
setLeaseID(java.lang.String xx)
|
void |
setLeaseWindow(long lw)
Set the duration of the lease. |
void |
setLongTimeoutPercent(int xx)
|
void |
setMaxRetries(int mr)
|
void |
setRetriesRemaining(int mr)
|
void |
setShortTimeoutPeriod(int xx)
|
void |
setType(java.lang.String tp)
|
void |
start()
Start the lease. |
| Methods inherited from class org.psepr.jClient.LeaseManager |
|---|
getConnection, getNamespace, parsePayload, setConnection, setNamespace |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleLeaseManager()
public SimpleLeaseManager(PsEPRConnection pConn,
java.lang.String chan,
java.lang.String type)
public SimpleLeaseManager(PsEPRConnection pConn,
java.lang.String chan,
java.lang.String type,
long interval)
| Method Detail |
|---|
public boolean getLeaseActive()
getLeaseActive in class LeaseManagerpublic long getLeaseWindow()
public void setLeaseWindow(long lw)
LeaseManager
setLeaseWindow in class LeaseManagerpublic long getLeaseGranted()
public void setLeaseGranted(long lg)
public java.lang.String getChannel()
public void setChannel(java.lang.String chan)
public java.lang.String getType()
getType in class LeaseManagerpublic void setType(java.lang.String tp)
setType in class LeaseManagerpublic int getMaxRetries()
public void setMaxRetries(int mr)
public int getRetriesRemaining()
public void setRetriesRemaining(int mr)
public int getShortTimeoutPeriod()
public void setShortTimeoutPeriod(int xx)
public java.lang.String getLeaseID()
LeaseManager
getLeaseID in class LeaseManagerpublic void setLeaseID(java.lang.String xx)
public int getLongTimeoutPercent()
public void setLongTimeoutPercent(int xx)
public long getLongTimeoutPeriod()
public int getLeaseState()
public java.lang.String getLeaseStateName()
public void start()
LeaseManager
start in class LeaseManagerpublic void release()
release in class LeaseManagerpublic void forceRenegotiation()
forceRenegotiation in class LeaseManagerpublic boolean receiveEvent(PsEPREvent pE)
receiveEvent in interface EventReceiverreceiveEvent in class LeaseManagerpE - the event structure
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||