Package net.i2p.router.transport.ntcp
Class EventPumper
java.lang.Object
net.i2p.router.transport.ntcp.EventPumper
- All Implemented Interfaces:
Runnable
class EventPumper extends Object implements Runnable
The main NTCP NIO thread.
-
Constructor Summary
Constructors Constructor Description EventPumper(RouterContext ctx, NTCPTransport transport)
-
Method Summary
Modifier and Type Method Description long
getIdleTimeout()
boolean
isAlive()
Selector can take quite a while to close after calling stopPumping()void
register(ServerSocketChannel chan)
Register the acceptor.void
registerConnect(NTCPConnection con)
Outboundstatic void
releaseBuf(ByteBuffer buf)
Return a read buffer to the pool.void
run()
The selector loop.void
startPumping()
void
stopPumping()
void
wantsRead(NTCPConnection con)
This is only called from NTCPConnection.complete() if there is more data, which is rare (never?) so we don't need to check for dups or make _wantsRead a Set.void
wantsWrite(NTCPConnection con)
Called by the connection when it has data ready to write (after bw allocation).void
wantsWrite(NTCPConnection con, byte[] data)
Called by the connection when it has data ready to write.void
wantsWrite(NTCPConnection con, byte[] data, int off, int len)
Called by the connection when it has data ready to write.
-
Constructor Details
-
Method Details
-
startPumping
public void startPumping() -
stopPumping
public void stopPumping() -
isAlive
public boolean isAlive()Selector can take quite a while to close after calling stopPumping() -
register
Register the acceptor. This is only called from NTCPTransport.bindAddress(), so it isn't clear why this needs a queue. -
registerConnect
Outbound -
run
public void run()The selector loop. On high-bandwidth routers, this is the thread with the highest CPU usage, so take care to minimize overhead and unnecessary debugging stuff. -
wantsWrite
Called by the connection when it has data ready to write. If we have bandwidth, calls con.Write() which calls wantsWrite(con). If no bandwidth, calls con.queuedWrite(). -
wantsWrite
Called by the connection when it has data ready to write. If we have bandwidth, calls con.Write() which calls wantsWrite(con). If no bandwidth, calls con.queuedWrite().- Since:
- 0.9.35 off/len version
-
wantsWrite
Called by the connection when it has data ready to write (after bw allocation). Only wakeup if new. -
wantsRead
This is only called from NTCPConnection.complete() if there is more data, which is rare (never?) so we don't need to check for dups or make _wantsRead a Set. -
releaseBuf
Return a read buffer to the pool. These buffers must be from acquireBuf(), i.e. capacity() == BUF_SIZE. High-frequency path in thread. -
getIdleTimeout
public long getIdleTimeout()
-