osnap.api.net
Class HeartBeat

java.lang.Object
  extended by java.lang.Thread
      extended by osnap.api.net.HeartBeat
All Implemented Interfaces:
java.lang.Runnable

public class HeartBeat
extends java.lang.Thread

A class designed to check if the connection to Core is still valid.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.net.Socket _coreSocket
           
private  ModuleInterface _module
           
private  boolean connected
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HeartBeat(java.net.Socket socket, ModuleInterface module)
          Constructor for creating this object.
 
Method Summary
 void run()
          Sends a heartbeat, a ping, to the Core in intervals of 30 seconds.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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
 

Field Detail

_coreSocket

private java.net.Socket _coreSocket

_module

private ModuleInterface _module

connected

private boolean connected
Constructor Detail

HeartBeat

public HeartBeat(java.net.Socket socket,
                 ModuleInterface module)
Constructor for creating this object.

Parameters:
socket - Socket to check for a live connection on
module - ModuleInterface using this object
Method Detail

run

public void run()
Sends a heartbeat, a ping, to the Core in intervals of 30 seconds. Will stop running when the connection is no longer open.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread