HI all,
I hv intregrated
Rhino javascript with Tomcat server. When i keep running my application its gettting slow.I monitor it with the response time and its gettting increese with the time. In my application i generate request delay with 10 ms.Following is my
test servlet.
public class StudentAction extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
ContextFactory factory = new ContextFactory();
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
long time1 = new Date().getTime();
Context cx = factory.enterContext();
try {
Scriptable scope = cx.initStandardObjects();
String s = "var i=10;var j=5;var x=i*j;";
cx.evaluateString(scope, s, "<cmd>", 1, null);
System.out.println(scope.get("x", scope));
} finally {
Context.exit();
}
long time2 = new Date().getTime();
System.out.println("Execute time :- " + (time2 - time1));
}
}