class PacketHandler extends Object
adjustThreads().| Constructor and Description |
|---|
PacketHandler(RouterContext ctx,
UDPTransport transport,
EstablishmentManager establisher,
InboundMessageFragments inbound,
PeerTestManager testManager,
IntroductionManager introManager)Create a new packet handler. |
| Modifier and Type | Method and Description |
|---|---|
(package private) void | adjustThreads()Dynamically adjust handler thread count to match the target. |
int | getActiveHandlers()Returns the current number of active handler threads. |
(package private) String | getHandlerStatus()Get the handler status string. |
static int | getMaxHandlers()Returns the current max packet handler threads. |
int | getProcessingCount()Returns the number of handlers actively processing packets (not parked on take()). |
double | getUtilization()Get packet handler pool utilization as a ratio (0.0-1.0). |
void | queueReceived(UDPPacket packet)Queue a received packet for processing. |
UDPPacket | receiveNext()Blocking call to retrieve the next inbound packet, or null if we have
shut down. |
static void | setMaxHandlers(int handlers)Sets the target max packet handler threads. |
void | shutdown()Shut down the packet handler. |
void | startup()Start the packet handler. |
PacketHandler(RouterContext ctx, UDPTransport transport, EstablishmentManager establisher, InboundMessageFragments inbound, PeerTestManager testManager, IntroductionManager introManager)
ctx - the router contexttransport - the UDP transportestablisher - the establishment managerinbound - the inbound message fragmentstestManager - the peer test managerintroManager - the introduction managervoid adjustThreads()
public int getActiveHandlers()
String getHandlerStatus()
public static int getMaxHandlers()
public int getProcessingCount()
public double getUtilization()
public void queueReceived(UDPPacket packet) throws InterruptedException
packet - the packetInterruptedException - if interrupted while waitingpublic UDPPacket receiveNext()
public static void setMaxHandlers(int handlers)
adjustThreads().handlers - the new max handlerspublic void shutdown()
public void startup()