Thankful if you have some suggestions!
mport java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
class Server implements HttpHandler
{
public void handle( HttpExchange httpExchange ) throws IOException
{
httpExchange.getResponseHeaders().add( "Content-type", "text/
html" );
String response = "test ";
httpExchange.sendResponseHeaders( 200, response.length() );
OutputStream os = httpExchange.getResponseBody();
os.write( response.getBytes() );
os.close(); //
}
public static void main(String[] args) {
HttpServer server = null;
try {
server = HttpServer.create( new InetSocketAddress( 80 ), 0 );
} catch(IOException e) {
}
server.createContext( "/", new Server() );
server.start();
}
}
This may not happen in your code but may happen somewhere in the
underlying API's and those are never reported and digested internally.
I had applied a fix for the same to get things going smoothly on one
of our demo earlier, here's the detail
http://mad-magnum.blogspot.com/2008/09/jdk16-hotspot-vm-leak-out-of-swap-space.html