|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.callback.logging.LogTemplate<C>
org.javasimon.callback.logging.DelegateLogTemplate<C>
org.javasimon.callback.logging.PeriodicLogTemplate<C>
public class PeriodicLogTemplate<C>
Log template that logs something after every N milliseconds. The isEnabled(Object) is only true after N milliseconds from the last log.
| Field Summary | |
|---|---|
private long |
nextTime
Timestamp of next invocation. |
private long |
period
Maximum time between two calls to log method. |
| Constructor Summary | |
|---|---|
PeriodicLogTemplate(LogTemplate delegate,
long period)
Constructor with other template and the required period in ms. |
|
| Method Summary | |
|---|---|
private long |
getCurrentTime()
Get current timestamp. |
long |
getNextTime()
Get next invocation time time. |
private void |
initNextTime()
Computes the next timestamp. |
boolean |
isEnabled(C context)
Tell whether logging is enabled. |
boolean |
isNextTimePassed()
Indicates whether next timestamp is in past. |
void |
log(String message)
Log a message. |
| Methods inherited from class org.javasimon.callback.logging.DelegateLogTemplate |
|---|
getDelegate |
| Methods inherited from class org.javasimon.callback.logging.LogTemplate |
|---|
log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final long period
private long nextTime
| Constructor Detail |
|---|
public PeriodicLogTemplate(LogTemplate delegate,
long period)
delegate - concrete log templateperiod - logging period in milliseconds| Method Detail |
|---|
public long getNextTime()
private long getCurrentTime()
private void initNextTime()
public boolean isNextTimePassed()
public boolean isEnabled(C context)
isEnabled in class DelegateLogTemplate<C>public void log(String message)
log in class DelegateLogTemplate<C>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||