REST WebService and concurrency in java

I'm going to write a simple REST web service to download files from the server (simple GET method) The question is, should I handle concurrency in this situation, or is the web server going to do this?

+3


source to share


3 answers


It depends on what you mean by "handle concurrency". Do you need to write code to create threads for every incoming request? No, Jersey will create a new thread for every request before it calls your API method. Do you need to worry about admission DELETE

when someone else is GET

in the file? Yes.



+2


source


Hmm, a bit of a vague question, but:



  • How do you implement the REST service using JAX-RS?
  • Depends on the server you are running it on.
  • What do you mean by "handle concurrency"? Since REST is stateless, concurrency shouldn't bother you.
+2


source


If you only use local variables of the method, the match is not a problem (the container handles this).

+1


source







All Articles