Jun 21st, 2010, 12:59 PM
Life of Singletons in EJB
I have written an application which is comprised of a number of Singletons. I have the main object which starts them all off using either a FileSystemXmlApplicationContext object or an XmlWebApplicationContext object (choose your poison, they both behave the same).
This all starts off fine and apears to work. Sadly, I can't seem to stop the wole thing w/o shutting down the app server. I am trying this on both JBoss and WebSphere.
What am I doing wrong? Just how do I stop (destroy) the singleton objects of my application? Is the fact that they each create a thread a factor?
Jun 28th, 2010, 02:05 PM
I have a hard time understanding your issue. If your app is web-base why do you have a main object starting the Spring application context? In any case you might want to look into this.
Jun 28th, 2010, 02:54 PM
My application is not web based. It consists of multiple modules listening on a jms message bus and acting on messages as they pass through the system.
I solved the problem for most of the modules by removing the thread, but there are still some, which having a thread is the way they work. These have to do with communications where the module is listening on a socket for incoming messages from an external device (non java).
It appears that if the protocol the external device used was HTTP, then life would be good, as the application server would handle the sockets I would just need a servlet to place the messages on the message buss.
Can any other protocol besides http be used?