Hi Mark,

I do not know why that code worked before,
but for me it is clear why it cannot reliable
work: When you call System.exit(0) from
within a ThreadPool's thread, then the ThreadPool
receives an interrupted exception and tries
to stop and join the running threads. Since
the thread that called exit cannot be joined
anymore, a deadlock occurs.

Your workaround is not a workaround but the
correct solution for the problem.

SNMP4J 1.x runs on Java 1.4, so Java 1.5 classes
are not an option.

Best regards,
Frank

Mark Gorokhov wrote:
I have an option to remotely shutdown the application. This is simple:
valid SET request for a scalar triggers System.exit() call. Everything
was fine until I upgraded to v1.9.1d and Agent-1.2beta. The
System.exit() is called from RequestPool thread. The application
partially (!) closes, shutdown hook is called but all threads remain
active and JVM remains running.

I resolved the issue with EventQueue.invokeLater(new Runnable() {
  public void run() {
    System.exit(0);
  }
});

Where is the problem? Could you reproduce it?
I inclined to blame new updates to ThreadPool.
BTW, there is a Sun tested ThreadPoolExecutor class since Java 1.5.

-mg

_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j

--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j

Reply via email to