org.opennms.protocols.snmp
Class SnmpTimer

java.lang.Object
  |
  +--org.opennms.protocols.snmp.SnmpTimer

class SnmpTimer
extends Object

Provides a simple timer scheduler for use by the internal SnmpSession class. Resolution is provided at the millisecond level.

Version:
$Revision: 1.10 $
Author:
Brian Weaver
See Also:
SnmpSession

Inner Class Summary
private  class SnmpTimer.Scheduler
          This object is the thread of execution that monitors and executes the scheduled runnables.
private  class SnmpTimer.TimeoutElement
          Used to track the individual runnables and when the runnable "expires".
 
Field Summary
private  boolean m_exit
          when true the internal thread should exit
private  LinkedList m_list
          The list of runnable objects (stored as TimeoutElement)
private  Object m_sync
          The synchronization object
private  Thread m_thread
          The thread doing the scheduling
 
Constructor Summary
(package private) SnmpTimer()
          Creates an SnmpTime object and it's internal thread that is used to schedual the execution of the runnables.
 
Method Summary
(package private)  void cancel()
          Cancels the current timer object and terminates the internal thread
(package private)  void schedule(Runnable runner, long milliseconds)
          Schedules the runnable to be run after AT LEAST ms milliseconds of time has expired.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_list

private LinkedList m_list
The list of runnable objects (stored as TimeoutElement)

m_thread

private Thread m_thread
The thread doing the scheduling

m_exit

private boolean m_exit
when true the internal thread should exit

m_sync

private Object m_sync
The synchronization object
Constructor Detail

SnmpTimer

SnmpTimer()
Creates an SnmpTime object and it's internal thread that is used to schedual the execution of the runnables.
Method Detail

schedule

void schedule(Runnable runner,
              long milliseconds)
Schedules the runnable to be run after AT LEAST ms milliseconds of time has expired. The runnable may be invoked in a delayed manner, but will not be run BEFORE ms milliseconds have expired.
Parameters:
runner - The runnable object
ms - The number of milliseconds to wait

cancel

void cancel()
Cancels the current timer object and terminates the internal thread