I have a query to answer remote clients' standard request. Standard in the sense that it takes no params from outside the server. Whenever 
anyone submits a request to a URL, say http://www.example.com/query, s/he gets the contents of an reply.xml in the body of the response, 
depending on what the database delivers at that time. 
The contents of reply.xml changes only across the contents of the database on the server, and doesn't change on anything external 
like who does the query, on which input, etc, hence takes no params from the clients. I'm not even checking any authentication-- we're leaving everything to the firewall. 
So i wrote a @POST method, say query() to get invoked on such a request posted to http://www.example.com/query, and deliver the result. I used Jersey at it and all is working fine to the specs, except that
the requests should be exclusive across time. 
that is, one request should be served at a time-- subsequent user-clicks should be getting a message with HTTP status 309 unless the server isn't running a query process invoked by my method query(). 
How to achieve this? I tried making query() serve @PUT rather than @POST responses, and got the same results. 
Maybe a naive Q on the topic. However, not very familiar with Restful services.
I can do this by threading on a token to control that only one query is running at a time and make simultaneous requests receive the HTTP 309. however there must be a better, easier way to achieve this on the server.
I'm using Tomcat 8, Jersey 1.19.
TIA.
Note: I've read PUT vs POST in REST among some other useful discussions.
//=====================
EDIT:
Which user submits the quer doesn't make any difference at any time.
Suppose userA submitted a query. while that query is still running, i.e., before query() returns the response to userA, userB submitted a query. userB should be getting a 309-- just because there's a query being processed at the time. 
Whether userA = userB or userA <> userB is immaterial here, a 309 should be returned just because there's a query request while one is already running. and thats the only time a user gets a 309. 
//==============================================
EDIT-2:
I'm aware of solutions w/concurrency control. I'm guessing that there is one using the Restful features. this is rather an academic Q.
 
     
     
    