|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.TimerTask
net.spy.util.TTL
public class TTL
A TTL object is used to express an intent for a process to finish within a certain amount of time.
A TTL object must be registered with a TTLMonitor before it
will report. The default implementation of report logs via
Logger.
| Constructor Summary | |
|---|---|
TTL(long ttl)
Get an instance of TTL. |
|
TTL(long ttl,
java.lang.Object extraInfo)
Get an instance of TTL with the given ttl and extra object. |
|
| Method Summary | |
|---|---|
void |
close()
Calling this method states that we are no longer interested in the progress of this TTL. |
protected void |
doReport()
Called when an object's TTL has expired without closing. |
java.lang.Object |
getExtraInfo()
Get the extra info provided for the TTL report. |
protected Logger |
getLogger()
Get the logger for this TTL. |
protected java.lang.String |
getMessageFromBundle(java.lang.String bundleName,
java.lang.String msgNoArg,
java.lang.String msgWithArg)
Get the message format string from the named bundle. |
int |
getReportInterval()
Get the report interval. |
long |
getTTL()
Get the number of milliseconds this TTL object is expected to be in use. |
boolean |
hasReported()
True if the TTL object has reported. |
boolean |
isClosed()
Return true if this TTL is no longer interesting. |
boolean |
isExpired()
Ask a TTL if it's expired. |
protected void |
reportWithFormat(java.lang.String msg)
Report a TTL expiration with the given format. |
void |
reset()
Resets the counter by setting the time that the TTL started to right now. |
void |
run()
Request a report of the TTL. |
void |
setExtraInfo(java.lang.Object o)
Provide extra information for the TTL report. |
void |
setMaxReports(int to)
Set the maximum number of reports this TTL should issue before automatically closing. |
void |
setReportInterval(int ms)
Set the minimum interval at which doReport() should be called when TTLMonitor sees this object as expired. |
java.lang.String |
toString()
String me. |
| Methods inherited from class java.util.TimerTask |
|---|
cancel, scheduledExecutionTime |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TTL(long ttl)
ttl - Number of milliseconds until the TTL fires
public TTL(long ttl,
java.lang.Object extraInfo)
ttl - Number of milliseconds until the TTL firesextraInfo - Extra info that will be toString()ed in the log| Method Detail |
|---|
protected Logger getLogger()
public void reset()
public java.lang.String toString()
toString in class java.lang.Objectpublic long getTTL()
public void setReportInterval(int ms)
public int getReportInterval()
public void setMaxReports(int to)
public boolean hasReported()
public void setExtraInfo(java.lang.Object o)
public java.lang.Object getExtraInfo()
public void close()
public boolean isClosed()
public boolean isExpired()
protected void reportWithFormat(java.lang.String msg)
msg - message format string to print when the TTL expires
protected java.lang.String getMessageFromBundle(java.lang.String bundleName,
java.lang.String msgNoArg,
java.lang.String msgWithArg)
bundleName - the name of the bundle from which to get the messagesmsgNoArg - the key in the bundle to use when there's no extra infomsgWithArg - the key in the bundle to use when there's extra info
protected void doReport()
public final void run()
run in interface java.lang.Runnablerun in class java.util.TimerTask
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||