This means that two consecutive HTTP-requests sent by the same user to the same GAE/J-app may very well be served by two different JVM:s.
The fact that multiple JVM:s are serving your requests might not be apparent since the GAE/J infrastructure makes sure that all objects you store in the session (HttpSession) are available across all JVM:s serving your app (this is done by temporarily storing your session objects in the datastore). On the other hand, you might notice that code within static blocks will be executed once for each JVM loading your code.
To identify which JVM that is serving a request, use the following code:
int currentJvm = Runtime.getRuntime().hashCode();I've written a small JSP-file that will show you which JVM that is serving the current request, and alert you when two consecutive HTTP-requests are being served by different JVM:s -- let's term this jumping between JVM:s the "GAE/J JVM dance" :-)
jvmdance.jsp: http://pastebin.com/f127200f1
3 comments: