https://issues.apache.org/bugzilla/show_bug.cgi?id=56426
Bug ID: 56426
Summary: load -on-startup creating instance to servlet twice
Product: Tomcat 7
Version: trunk
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Servlet & JSP API
Assignee: [email protected]
Reporter: [email protected]
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.ace2three.adminportal.web;
import com.ace2three.web.dao.CommonDAO;
import com.ace2three.platform.server.impl.ApplicationContext;
import com.ace2three.pool.DAOFactory;
import com.ace2three.utils.LeaderBoardThread;
import com.ace2three.web.dao.AdminToolDAO;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import org.apache.log4j.Logger;
/**
*
* @author sridhar
*/
public class LoadConfig extends HttpServlet {
private static Logger log = Logger.getLogger(LoadConfig.class);
private boolean alreadyInitialized = true;
public void init(ServletContext context) throws ServletException {
// TODO Auto-generated method stub
ServletConfig config = null;
super.init(config);
//-Dlog4j.configuration=file:D:\acc_config\log4j.xml
if (this.alreadyInitialized)
{
try {
new LeaderBoardThread().start();
} catch (Exception e) {
log.info("Exception in loadConfig :: "+e);
e.printStackTrace();
}
this.alreadyInitialized = false;
}
}
@Override
public void destroy() {
log.info( "Destroy called", new Throwable() );
super.destroy();
this.alreadyInitialized = false;
}
/*@Override
public void init( ServletConfig config )
throws ServletException
{
log.info( "Init called, config="+config, new Throwable() );
super.init( config );
if (this.alreadyInitialized)
{
log.error( "Already initialized");
throw new IllegalStateException( "Already initialized" );
}
this.alreadyInitialized = true;
}*/
}
LeaderBoardThread: ******** Calling leader board Therad ******************
708770251
LeaderBoardThread: ******** Calling leader board Therad ******************
1200582472
here am getting two thread process for every tomcat restart please check
hash codes also here for therad process
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]