SHARE
TWEET

sb

a guest Apr 12th, 2009 210 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  2. <%@ page import="java.io.*, java.net.*, java.util.*" %>
  3. <%
  4.   int currentJvm = Runtime.getRuntime().hashCode();
  5.   int previousJvm = 0;
  6.   if (session.getAttribute("previous_jvm") != null) {
  7.     previousJvm = (Integer) session.getAttribute("previous_jvm");
  8.   }
  9.   // Make sure sessions-enabled=true in WEB-INF/appengine-web.xml
  10.   session.setAttribute("previous_jvm", currentJvm);
  11.  %>
  12. <html>
  13.   <head>
  14.     <title>JVM: <%= currentJvm %></title>
  15.   </head>
  16.   <body style="font-family: courier;">
  17.     This request was handled by JVM #<%= currentJvm %>.<p />
  18.  
  19. <% if (previousJvm != 0) {  %>
  20.     Your previous request was handled by JVM #<%= previousJvm %>.<p />
  21. <% } %>
  22.  
  23. <% if (previousJvm != 0 && currentJvm != previousJvm) { %>
  24.     <b style="color: red;">Current JVM != Previous JVM</b><p />
  25. <% } %>
  26.  
  27.   </body>
  28. </html>
RAW Paste Data
Top