>It seems simple enough except for one thing. The last line returns
>away. Afterwards, the variable "server" goes out of context and is
>available to be gc'ed.
Your reference to the server can be GCed. If other threads are holdin=
references to it, than the server will not be GCed.
>After that, "main" ends and so should this program.
>However, in reality the server is working just fine. What's going on?=
>understand that the server may be spinning off other threads, etc, bu=
>a program terminates, that's the end. Sorry if this is a stupid
>but I've never seen anything done like this before (maybe something
>peculiar to Java??).
The JVM will keep running as long as non-daemon threads are running. =
I had to guess, I'd say you're creating a non-daemon thread to run the=
server. So that when the main thread exits, the server thread and
therefore the JVM stays running. The JavaDoc for java.lang.Thread
This e-mail, including any attachments, is a confidential business com=
munication, and may contain information that is confidential, propriet=
ary and/or privileged. This e-mail is intended only for the individua=
l(s) to whom it is addressed, and may not be saved, copied, printed, d=
isclosed or used by anyone else. If you are not the(an) intended reci=
pient, please immediately delete this e-mail from your computer system=
and notify the sender. Thank you.