I have a method call on one line and immediately afterwards I have a different method call. The first goes and reads a record in and assigns it to a variable and the other writes. In JSP is it possible for the second method to be hit before the first has finished? If so, how can I avoid this from happening? The method calls are third party. Thanks.
Hi Bear, The reason why I'm asking is that it appears the lock held by the read has not been released before the write method call directly after it. Have you encountered anything like this? I know you said sequential processing just wondering about a database lock sticking around long enough for the write to complain it's already locked. Is there a straight up way to sleep or nap for a small amount of time in JSP to test this theory out? Thanks again.
Not to be persnickety, but doing DB access in a JSP is an egregious violation of all best practices and patterns. And a pain in the rear to debug.
My advice is to factor all that code out of the JSP into a Java class that you can test stand-alone. A much easier scenario to debug.
Once you you've got things working there, you can either connect to this code via a bean in the page (poor, but better than code in the JSP), or in a servlet controller for the page (much better) all under Java control.