I have a JAX-RS (RESTEasy) endpoint. Within the endpoint method I am checking a database timestamp column for a JPA entity and if the column is null then I save the current time, raise an alert and return success, if the column already has a time set then I do nothing and return success.
Now I am finding that if the endpoint is called 5/6 times in quick succession (within the same 500ms) then every request is seeing the column as null and I get 5/6 alerts raised where I only wanted one.
I assume this is because the requests are processed asynchronously and the database changes have not been fully committed until after the last request.
Is it possible to force the server to process requests for this endpoint synchronously? So that they are queued and only processed when all transactions have been committed? If not is there a better solution to this problem?