I'm just going to give you a partial answer, since it's all I am capable
of. I think that you probably want to make your application event driven
so that requests come in the form of passed events, then the app just sits
there waiting for events. Alternately, if it is a server, I think that
you can leave it in ServerSocket.accept(), and it will just wait for
connections without consuming cycles.
I haven't quite figured out what keeps an app from exiting. It seems that
if you don't put a return; at the end of the main() method, it will sit
idly. Maybe someone else can give a definitive answer.
Richard Hall
Network Services
University of Tennessee