From 2d9d8f32dcc6920b05cc7a55a55bb1dafeebc336 Mon Sep 17 00:00:00 2001 From: jrandom <jrandom> Date: Sat, 4 Dec 2004 23:43:07 +0000 Subject: [PATCH] 2004-12-03 jrandom * Toss in a small pool of threads (3) to execute the events queued up with the SimpleTimer, as we do currently see the occational event notification spiking up to a second or so. * Implement a SAM client API in java, useful for event based streaming (or for testing the SAM bridge) * Added support to shut down the SAM bridge on OOM (useful if the SAM bridge is being run outside of the router). * Include the SAM test code in the sam.jar * Remove an irrelevent warning message from SAM, which was caused by perfectly normal operation due to a session being closed. * Removed some unnecessary synchronization in the streaming lib's PacketQueue * More quickly clean up the memory used by the streaming lib by immediately killing each packet's resend job as soon as it is ACKed (or cancelled), so that there are no longer any valid pointers to the (potentially 32KB) packet. * Fixed the timestamps dumped to stdout when debugging the PacketHandler. * Drop packets that would expand our inbound window beyond our maximum buffer size (default 32 messages) * Always read the ACK/NACK data from the verified packets received, even if we are going to drop them * Always adjust the window when there are messages ACKed, though do not change its size except as before. * Streamlined some synchronization in the router's I2CP handling * Streamlined some memory allocation in the SAM bridge * Default the streaming lib to disconnect on inactivity, rather than send an empty message. --- apps/sam/java/src/net/i2p/sam/SAMBridge.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/sam/java/src/net/i2p/sam/SAMBridge.java b/apps/sam/java/src/net/i2p/sam/SAMBridge.java index c1dd7fe8a1..3f692571e0 100644 --- a/apps/sam/java/src/net/i2p/sam/SAMBridge.java +++ b/apps/sam/java/src/net/i2p/sam/SAMBridge.java @@ -220,6 +220,15 @@ public class SAMBridge implements Runnable { } SAMBridge bridge = new SAMBridge(host, port, opts, keyfile); I2PThread t = new I2PThread(bridge, "SAMListener"); + if (Boolean.valueOf(System.getProperty("sam.shutdownOnOOM", "false")).booleanValue()) { + t.addOOMEventListener(new I2PThread.OOMEventListener() { + public void outOfMemory(OutOfMemoryError err) { + err.printStackTrace(); + System.err.println("OOMed, die die die"); + System.exit(-1); + } + }); + } t.start(); } -- GitLab