Niclas Hedhman wrote:
I'm not into politics, but please explain why a "Socket Server" should hang around in memory if it is not referenced?

IIUIC, a socket server will be listening on a socket, i.e. the thread is blocked, and the thread management will maintain the reference to its Runnable entry and GC will not mark it as "garbage". No?

I doubt that's guaranteed....


class MyServer
{
  initialize()
  {
    new Thread( new Runnable { /*...*/ } ).start();
  }
}

nothing references the thread, only the thread references the runnable, only the runnable references the socket, nothing references myserver.

Yes, the thread management references the thread, but I think that's (allowed to be) a weak reference.

Potentially unsafe. Icky. Depends on some JVM characterstic. It seems to me the "principle of too much magic" applies. Better to be conservative.

Now, I think its vital to have a setup that reclaims resources in long-running appservers, and I think this is a cool feature Steve's putting into place, but I'm weary of changing default policies. An assembler had better known darn well a component can be reclaimed and make a conscious choice to enable that (the lifecycle tags seem feasible for that).

cheers!

- LSD



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to