|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.idle.Idler
public class Idler
Idler starts a thread that periodically runs a task to see if any activity has
occurred. If no indication of activity has after a fixed amount of time (set by
the int delay), the Idler returns true when queried with isIdle().
This is used in logging to keep track of actual usage vs. the application merely
being open, using the method getElapsed(boolean,boolean).
Note that once instantiated, call start() to begin idle checking.
| Field Summary | |
|---|---|
static long |
DEFAULT_DELAY
An int containing the default number of milliseconds before going into an idle state. |
static String |
IDLE_ACTIVE
Feature identifier: log active. |
static String |
IDLE_FEATURE_PFX
Idler Feature prefix. |
static long |
m_initialDelay
The initial delay before the first idle check (in milliseconds). |
| Constructor Summary | |
|---|---|
Idler(MessageHandler messagehandler)
Default constructor provided with a MessageHandler. |
|
Idler(MessageHandler messageHandler,
long delay)
Constructor provided with a MessageHandler and an idle time delay (in milliseconds). |
|
| Method Summary | |
|---|---|
void |
active()
When called, indicates system activity, such that an idle state is delayed. |
void |
addIdleListener(IdleListener listener)
Add a listener for changes to the idle state. |
protected void |
fireIdleStateChanged()
Notify all listeners that have registered interest for notification on this event type. |
long |
getElapsed(boolean active,
boolean millis)
Returns a long indicating the number of milliseconds passed since the application session began. |
boolean |
isIdle()
Returns the current idle state. |
boolean |
isStarted()
Returns true if the Idler (Timer) task has been started. |
void |
removeIdleListener(IdleListener listener)
Remove a listener for changes to the idle state. |
void |
setDelay(long delay)
Sets the idle delay to the long delay. |
void |
start()
Schedule an idle check using a new Timer and the current delay time. |
void |
stop()
This method should be called prior to application termination to close all extant timer tasks. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String IDLE_FEATURE_PFX
public static final String IDLE_ACTIVE
public static long m_initialDelay
public static final long DEFAULT_DELAY
| Constructor Detail |
|---|
public Idler(MessageHandler messagehandler)
start() to begin idle checking.
public Idler(MessageHandler messageHandler,
long delay)
| Method Detail |
|---|
public void start()
public void stop()
public boolean isStarted()
public void setDelay(long delay)
public boolean isIdle()
public void active()
public long getElapsed(boolean active,
boolean millis)
public void addIdleListener(IdleListener listener)
public void removeIdleListener(IdleListener listener)
protected void fireIdleStateChanged()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||