I created a small web application using jsp and servlet. My ajax post method call the java class for every three seconds. I want to know for every 3 secs, java class variables isBootRunning,istest1Running,istest1Running is initialized to "null" or not. If it will initialized for every request, how to prevent this initialization.
My JSP:
setInterval(function(){
            TestReport(); 
        }, 3000); 
function TestReport(){
var tbname = $("#tbname").attr('class');
var userName = $("#userName").attr('class');
var name = tbname;
var url ="TestReport";
var params = {
        tbname: tbname,
        userName:userName
};
$.post('TestReport', {
    tbname: tbname,
    userName:userName,
}, function(responseText) {
    alert(responseText);
});
}
My Servlet:
public class TestReport extends HttpServlet {
private static final long serialVersionUID = 1L;
String isBootRunning = null;
String istest1Running = null;
String istest2Running = null;
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        File f1 = new File("myfirstpath");//this directory is visible for 10 mins only 
        File f2 = new File("mythirdpath");//this directory is visible for 10 mins only
        File f3 = new File("mythirdpath");//this directory is visible for 10 mins only
        if (f1.exists() && f1.isDirectory()) {
            isBootRunning = "Running";
            istest1Running = "Scheduled";
            istest2Running = "Scheduled";
        } else if(f2.exists() && f2.isDirectory()){
            istest1Running = "Running";
            istest2Running = "Scheduled";
            if(isBootRunning=="Running"){
                //here my logic
            }
        } else if(f2.exists() && f2.isDirectory()){
            istest2Running = "Running";
            if(isBootRunning=="Running"){
                //here my logic
            }
            if(istest1Running=="Running"){
                //here my logic
            }
        }
    }
}
 
     
    