My spring MVC controller is being called twice. The most annoying thing is that it's not deterministic, some times it happens some times not. The instance of the controller bean is the same (I've printed the reference) but the stack call is different. I've printed it and made a diff and the only difference is:
< at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
---
> at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
So it seems that one is called by line 310 and the other one is called by 312. It seems to happen when the request takes a little more time (it has to go to the database, etc).
I've tested with FF and Chrome and also this request is a GET request made via the browser bar so it doesn't have any kind of front-end code.
The application is running under Apache Tomcat/7.0.47.
Code example:
@Controller
@RequestMapping(value = "/base")
public class AdyenApiController {
@Autowired
private AdyenNotificationService service;
@RequestMapping(value = "/debug/due", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<String> dueScheduler() {
try {
throw new RuntimeException();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("> " + this);
System.out.println("EXECUTING?!");
service.processModifications();
return new ResponseEntity<>("processed dues)", HttpStatus.OK);
}
}
Does someone have any idea what this might be?