JML

net.sf.jqql.obsolete
Class HeartBeatThread

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.jqql.obsolete.HeartBeatThread
All Implemented Interfaces:
Runnable

public class HeartBeatThread
extends Thread

 Heart beat thread, beat per 3 second, checkout current status when beat, if there is packet need to resend, then resend
 if add up 30 beat there isn't any reply, stop transfer as network error. if other side has reply, just not reply heart  * beat, stop current handle after 15 beat, til opp opposite reply heart beat, and continue other handle.
 Heart beat 线程,每3秒一跳,跳时检查当前状态,若有需要重发的包,则重发
 如果累计30跳都没有任何回应,当作网络错误停止传输。如果其他方面有回应,但是
 就是不回应heart beat,在15跳之后停止当前操作,直到对方回应heart beat后才
 继续其他的操作
 

Author:
luma

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HeartBeatThread(FileSender sender)
          constructed function 构造函数
 
Method Summary
 void run()
           
 void setAnybodyLiving(boolean anybodyLiving)
           
 void setMaxReply(char maxReply)
           
 void setStop(boolean stop)
           
 
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
 

Constructor Detail

HeartBeatThread

public HeartBeatThread(FileSender sender)
constructed function 构造函数

Parameters:
sender -
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

setStop

public void setStop(boolean stop)
Parameters:
stop - The stop to set.

setMaxReply

public void setMaxReply(char maxReply)
Parameters:
maxReply - The maxReply to set.

setAnybodyLiving

public void setAnybodyLiving(boolean anybodyLiving)
Parameters:
anybodyLiving - The anybodyLiving to set.

JML