Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I allow only one session to Spring REST web service at one time?

I have a spring REST web service URL http://localhost:8080/MySpringRestService/callSome

How can I restrict concurrent access to web service.

My requirement is to allow only one request to web service at one time.

Any kind of help would be appreciate.

like image 763
tinlinnsoe Avatar asked Oct 18 '22 06:10

tinlinnsoe


1 Answers

Thanks kiwiron. It works.

Sample code is

@RequestMapping(value = RestURIConstants.GET_BALANCE_URL, 
method = RequestMethod.POST)
public synchronized @ResponseBody RESSmppModel getBalance(
        @RequestBody REQSmppModel reqSmppModel) throws Exception {

       // TODO: Code
}

But , the performance is not good.

like image 137
tinlinnsoe Avatar answered Oct 21 '22 06:10

tinlinnsoe