|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
no.ntnu.item.router.utilities.SessionPinger
public class SessionPinger
This class will obtain ping measurements for the given ServiceSession
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
(package private) java.lang.Double[] |
pingValues
Holds the 5 last ping values for computing average |
private ServiceSession |
serviceSession
The ServiceSession for which this class will sample ping |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SessionPinger(ServiceSession session)
Constructor. |
Method Summary | |
---|---|
private void |
addPingValue(java.lang.Double pingAddress)
Updates the array of ping values with a new one |
private static void |
close(java.io.Closeable c)
Closes the object given as parameter |
java.lang.Double |
getPing()
Uses the array of ping values. Summarizes and averages them. |
private boolean |
haveNoPingValues()
Checks if the pingValues array is empty(all 0) |
private java.lang.Double |
pingAddress(java.net.InetSocketAddress addr)
/** Running ping command in linux. |
void |
run()
The running method |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, 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 |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ServiceSession serviceSession
ServiceSession
for which this class will sample ping
java.lang.Double[] pingValues
Constructor Detail |
---|
public SessionPinger(ServiceSession session)
session
- the session to ping forMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.lang.Double getPing()
private void addPingValue(java.lang.Double pingAddress)
pingAddress
- to addprivate java.lang.Double pingAddress(java.net.InetSocketAddress addr)
addr
- address of the server to ping
private boolean haveNoPingValues()
private static void close(java.io.Closeable c)
c
- a closable object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |