public class PingThread extends Thread
Since 1.0.0 PingThread supports mutliple connections so do don't have to start multiple threads to keep several connections alive.
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
PingThread()
Creates a new PingThread.
|
PingThread(ManagerConnection connection)
Creates a new PingThread that uses the given ManagerConnection.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnection(ManagerConnection connection)
Adds a connection to the list of pinged connections.
|
void |
die()
Terminates this PingThread.
|
protected void |
ping(ManagerConnection c)
Sends a ping to Asterisk and logs any errors that may occur.
|
void |
removeConnection(ManagerConnection connection)
Removes a connection from the list of pinged connections.
|
void |
run() |
void |
setInterval(long interval)
Adjusts how often a PingAction is sent.
|
void |
setTimeout(long timeout)
Sets the timeout to wait for the ManagerResponse before throwing an
excpetion.
|
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
public PingThread()
addConnection(ManagerConnection)
to add connections
that will be pinged.public PingThread(ManagerConnection connection)
connection
- ManagerConnection that is pingedpublic void setInterval(long interval)
interval
- the interval in millisecondspublic void setTimeout(long timeout)
timeout
- the timeout in milliseconds or 0 to indicate no timeout.public void addConnection(ManagerConnection connection)
connection
- the connection to ping.public void removeConnection(ManagerConnection connection)
connection
- the connection that will no longer be pinged.public void die()
protected void ping(ManagerConnection c)
c
- the connection to ping.Copyright © 2004–2017. All rights reserved.