I have a glassfish server and I hope it should be loaded. For example, I have lush services and I want to make a request to Google API in a method. Should I make a new thread to do such a thing?
No, you should not manage anything with thread manually inside Java eE world Work should be provided by the container (in this case glassfish), especially for an HTTP response
It is also prohibited inside EJB:
The enterprise bean should not try to manage the thread, the enterprise bean should start, stop, suspend or rearrange the thread. Should not try to start, or do not have to change the priority or name of the thread. Enterprise Bean should not try to manage the thread group.
(EJB 3.1 spec, p. 599)
There are some exceptions where you may have to do something manually, a web application, but to avoid it normally needed.
Also see:
No comments:
Post a Comment