It’s good that the Eclipse story works even one day ago. Thanks to this, I can give both Ravi a working example and Lirik his answer to the leak.
Let me start by stating that I don’t know what causes this leak, but if I leave it long enough it will fail on OutOfMemoryError .
Secondly, I left the working code commented out for Ravi for the working base example of my UDP server. The timeout was there to check how long my firewall would kill the end of the receivers (30 seconds). Just delete everything with the pool and you are good to go.
So, here is a working, but leaking version of my example with a streaming UDP server.
public class TestServer { private static Integer TIMEOUT = 30; private final static int MAX_BUFFER_SIZE = 8192; private final static int MAX_LISTENER_THREADS = 5; private final static SimpleDateFormat DateFormat = new SimpleDateFormat("yyyy-dd-MM HH:mm:ss.SSSZ"); private int mPort; private DatagramSocket mSocket;
by the way. @Lirik, I first saw this behavior in Eclipse, after which I checked it from the command line. And again, I do NOT know what causes it;) sorry ...
source share