Socket listening inside the container is nor recommended, but you could do socket listening inside the init() method of a servlet.
Well, I think that's my point. I'm listening outside the container and would like to get back inside the container when a connection/datagram arrives.
Can you expand a little on why listening inside the container is a bad idea? I've been running this application in Jboss for 3 years and haven't had any problems with the approach I'm using.
1 of 1 people found this helpful
I've done many services that only spoke TCP (not HTTP).
By DI, I assume you mean CDI. And so this is more of a CDI/Weld question, but I'll try to answer.
Basically, what the container does is activate CDI contexts as part of HTTP request handling. You can do this yourself by obtaining a reference to the BeanManager through JNDI. I don't really know much more than this. I suppose you can look at the source code (get yourself a stack trace) and see how, say, RequestScope is activated.
Okay. So lets say I get the BeanManager and then use it to get some object and all it's dependent objects. What are the ramifications of then passing that object to another thread?