server
Class DeviceThread

java.lang.Object
  extended byjava.lang.Thread
      extended byserver.DeviceThread
All Implemented Interfaces:
java.util.Observer, java.lang.Runnable

public class DeviceThread
extends java.lang.Thread
implements java.util.Observer

Controls the polling of all attributes associated with a single Device. Responsible for uncovering all the monitored Interfaces and each Interface's monitored Attributes. This thread polls each attribute at the Attribute's polling frequency (in seconds).

To handle the polling frequencies, DeviceThread creates a dedicated Timer thread, which supplies one second interrupts.

Version:
0.1
Author:
ryan/gswalters
See Also:
Timer

Nested Class Summary
 class DeviceThread.PollInfo
          Inner class to hold a time and boolean indicating polling required.
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DeviceThread(Device myDevice, GLTMonitor controller, Conf config)
          Construct a DeviceThread object for a specific Device.
 
Method Summary
 void run()
          The DeviceThread builds a list of monitored Interfaces w/ monitored attributes.
 void update(java.util.Observable o, java.lang.Object arg)
          Process the notifications from all possible observable objects.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeviceThread

public DeviceThread(Device myDevice,
                    GLTMonitor controller,
                    Conf config)
Construct a DeviceThread object for a specific Device. Set the Device this thread monitors, and the GLTMon application as controller for change notification.

Also create the Timer thread, but don't start it yet.

Parameters:
myDevice - Device object for which to poll attributes
controller - GLTMon object that will notify us of changes
Method Detail

run

public void run()
The DeviceThread builds a list of monitored Interfaces w/ monitored attributes. Each attribute will be polled based on the Attribute's polling information (frequency and max rate). Each poll is saved to the PollResult table.

Specified by:
run in interface java.lang.Runnable

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Process the notifications from all possible observable objects. DeviceThread observes a Timer thread for second interrupts, and the controller thread (GLTMon) for changes to its operations.

Specified by:
update in interface java.util.Observer
See Also:
Observer.update(java.util.Observable, java.lang.Object)