java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.i2ptunnel.I2PTunnelOutproxyRunner.StreamForwarder
- All Implemented Interfaces:
Runnable
- Enclosing class:
I2PTunnelOutproxyRunner
Forwards data from
InputStream to OutputStream. Flushes are batched by checking available bytes without forced sleeps.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 ByteCacheCache supplying the copy buffers.private final booleanTrue when copying toward I2P.private final StringName of the direction being copied.private final InputStreamStream the data is read from.private final OutputStreamStream the data is written to.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYConstructor Summary
ConstructorsModifierConstructorDescriptionprivateStreamForwarder(InputStream in, OutputStream out, boolean toI2P) Constructs a forwarder thread for one data direction.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidrun()Pump datagrams between the external socket and the tunnel until either side closes.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
in
Stream the data is read from.out
Stream the data is written to.direction
Name of the direction being copied._toI2P
private final boolean _toI2PTrue when copying toward I2P._cache
Cache supplying the copy buffers.
Constructor Details
StreamForwarder
Constructs a forwarder thread for one data direction.- Parameters:
in- InputStream to read fromout- OutputStream to write totoI2P- true if forwarding toward I2P side
Method Details
run