Monday, November 9, 2009

I noticed an exception handler in a listener that has been added to a service. Why is there a System.exit?

} catch (IOException e) {
System.err.println("Could not listen on port: " + portNumber + ".");
System.exit(-1);
}

Any IOException in the listener will halt the entire system. I don't know if that is intentional. At the moment, this listener is pretty much a prototype. The rest of the system is running in production. I imagine that testers would be annoyed if the System.exit blocks the testing of everything else if there are problems with the new listener.

Actually, the webapp would probably just respawn repeatedly until the problem fixes itself, which would probably be never.

No comments:

Post a Comment