java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.i2ptunnel.I2Ping.PingHandler
- All Implemented Interfaces:
Runnable
- Enclosing class:
I2Ping
Thread running one ping session.
Nested Class Summary
Nested classes/interfaces inherited from class I2PThread
I2PThread.OOMEventListenerModifier and TypeClassDescriptionstatic interfaceListener for out-of-memory events.Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandlerField Summary
FieldsModifier and TypeFieldDescriptionprivate final intNumber of pings to send.private final booleanTrue to count the replies toward the tunnel stats.private final StringThe destination being pinged.private final intThe local I2CP port to send from.private final intThe remote I2CP port to send to.private final booleanTrue to report each reply time.private final longTime allowed for one reply.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYConstructor Summary
ConstructorsConstructorDescriptionPingHandler(String dest, int count, int fromPort, int toPort, long timeout, boolean countPings, boolean report) Runs one ping session.Method Summary
Modifier and TypeMethodDescriptionprivate DestinationFinds the destination for a name or address.voidrun()Ping the destination once per requested count and report the result.Methods inherited from class I2PAppThread
addOOMEventThreadListener, fireOOM, removeOOMEventThreadListenerModifier and TypeMethodDescriptionvoidRegister a new component that wants notification of OOM events.protected voidfireOOM(OutOfMemoryError oom) Notify listeners that an OutOfMemoryError occurred.voidUnregister a component that wants notification of OOM events.Methods inherited from class I2PThread
addOOMEventListener, removeOOMEventListener, startModifier and TypeMethodDescriptionstatic voidRegister a new component that wants notification of OOM events.static voidUnregister a component that wants notification of OOM events.voidstart()Overridden to provide useful info to users on OOM, and to prevent shutting down the whole JVM for what is most likely not a heap issue.Methods inherited from class Thread
activeCount, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, threadId, toString, yield
Field Details
destination
The destination being pinged.cnt
private final int cntNumber of pings to send.timeout
private final long timeoutTime allowed for one reply.countPing
private final boolean countPingTrue to count the replies toward the tunnel stats.reportTimes
private final boolean reportTimesTrue to report each reply time.localPort
private final int localPortThe local I2CP port to send from.remotePort
private final int remotePortThe remote I2CP port to send to.
Constructor Details
PingHandler
public PingHandler(String dest, int count, int fromPort, int toPort, long timeout, boolean countPings, boolean report) Runs one ping session.- Parameters:
dest- the destination to pingcount- the number of pings to sendfromPort- the local port to send fromtoPort- the remote port to send totimeout- the time allowed for one replycountPings- true to count replies toward the tunnel statsreport- true to report each reply time
Method Details
run
lookup
Finds the destination for a name or address.- Parameters:
name- the base32 or base64 address, or a local name- Returns:
- the destination found
- Throws:
I2PException- if the name cannot be resolved