What will happen when a JSP is requested at the same time it's updated?
I've been wondering about this for some time.
If I have an index.jsp file, and there's a http request for the jsp while at the same time index.jsp is being overwritten, what will happen?
A. Http Request will return an error message while the file is being overwritten.
B. JSP is served as normal and the index.jsp overwrite process fails
C.. any other possibility?
The same scenario could be applied to any non-JSP files, I'm just thinking if there's any difference with the fact that the JSP will then be compiled etc and how that impacts the response from the app server.
TIA
My understanding is as follows:
Any file that is being written will be locked by the operating system, so the request would be delayed by a few milliseconds until the file is unlocked.
The JSP application server (Tomcat or similar) will check the compiled version against the jsp file. If the jsp file is newer it will be re-compiled.
Once Tomcat 'knows' the compiled version is up to date the request is dealt with.
> A. Http Request will return an error message while the file is being overwritten.
No, the page will be delayed while writing / compilation takes place. You will observe this while developing, i.e. the first time a page is run after alteration it takes longer to load in the browser.