jclass
Class SleepingThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--jclass.SleepingThread
Direct Known Subclasses:
CommunicationServerThread, ConnectServerThread, DistributedMaintenanceWatchdog, ServerTCPThread, ServerUDPThread, TCPIPReadThread, TCPIPWriteThread

public class SleepingThread
extends java.lang.Thread

A thread skeleton that implements a variable and a method that allows setting a internal sleeping interval.

Written: Radu Sion
Version: 0.17x
Source: SleepingThread.java

Visit Smart Software 

See Also:
dbg

Field Summary
static long DEFAULT_SLEEP
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SleepingThread()
           
SleepingThread(java.lang.Runnable r)
           
 
Method Summary
 long getSleep()
          Returns the internal sleep delay.
 void mysleep(long sleep)
          Implements a sort of sleep that does NOT throw any exception.
 void pause()
          Makes a pause according to the internal sleep.
 void pause(float adjust)
          Makes a pause according to the internal sleep multiplied to the adjust parameter.
 void setSleep(long sleep)
          Sets the internal sleep delay, used when appealing .pause() If invalid value then the sleep delay remains unchanged.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, 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
 

Field Detail

DEFAULT_SLEEP

public static final long DEFAULT_SLEEP
Constructor Detail

SleepingThread

public SleepingThread(java.lang.Runnable r)

SleepingThread

public SleepingThread()
Method Detail

setSleep

public void setSleep(long sleep)
Sets the internal sleep delay, used when appealing .pause() If invalid value then the sleep delay remains unchanged. It is internally synchronized !!!
Parameters:
sleep - New internal sleep delay to use

getSleep

public long getSleep()
Returns the internal sleep delay.

pause

public void pause()
Makes a pause according to the internal sleep.

mysleep

public void mysleep(long sleep)
Implements a sort of sleep that does NOT throw any exception.
Parameters:
sleep - Number of ms to sleep

pause

public void pause(float adjust)
Makes a pause according to the internal sleep multiplied to the adjust parameter.
Parameters:
adjust - Adjusting sleep delay factor