java - Should I start a new thread to get HTTP response on my server? -


i have glassfish server , expect rather loaded. example, have restful services , want make request google api in 1 of methods. should create new thread such work?

no, should avoid managing threads manually inside java ee world. work should provided container (glassfish in case), http response.

inside of ejbs prohibited:

the enterprise bean must not attempt manage threads. enterprise bean must not attempt start, stop, suspend, or resume thread, or change thread’s priority or name. enterprise bean must not attempt manage thread groups.

(ejb 3.1 spec, page 599)

there exceptions may need manually in web application, in general should avoided.

see also:


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -