additional tracery to track down the persistent OutOfMemoryError on EMinds

This commit is contained in:
Eric J. Bowersox 2004-05-17 03:45:26 +00:00
parent 4550100675
commit 55db78c0e9
4 changed files with 58 additions and 24 deletions

View File

@ -73,21 +73,21 @@ public class ScriptManager
public void fatal(Object message)
{
if (logger_stack.size()>0)
((Category)(logger_stack.getFirst())).fatal(message);
((Logger)(logger_stack.getFirst())).fatal(message);
} // end fatal
public void error(Object message)
{
if (logger_stack.size()>0)
((Category)(logger_stack.getFirst())).error(message);
((Logger)(logger_stack.getFirst())).error(message);
} // end error
public void warn(Object message)
{
if (logger_stack.size()>0)
((Category)(logger_stack.getFirst())).warn(message);
((Logger)(logger_stack.getFirst())).warn(message);
} // end warn
@ -95,9 +95,9 @@ public class ScriptManager
{
if (logger_stack.size()>0)
{ // check to make sure info is enabled first
Category cat = (Category)(logger_stack.getFirst());
if (cat.isInfoEnabled())
cat.info(message);
Logger l = (Logger)(logger_stack.getFirst());
if (l.isInfoEnabled())
l.info(message);
} // end if
@ -107,9 +107,9 @@ public class ScriptManager
{
if (logger_stack.size()>0)
{ // check to make sure debug is enabled first
Category cat = (Category)(logger_stack.getFirst());
if (cat.isDebugEnabled())
cat.debug(message);
Logger l = (Logger)(logger_stack.getFirst());
if (l.isDebugEnabled())
l.debug(message);
} // end if
@ -122,7 +122,7 @@ public class ScriptManager
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(ScriptManager.class);
private static Logger logger = Logger.getLogger(ScriptManager.class);
private static final Class[] fixupRhino_parmtypes = { Boolean.TYPE };
private static final Object[] fixupRhino_parms = { Boolean.FALSE };
@ -150,6 +150,9 @@ public class ScriptManager
*/
public ScriptManager(String temp_dir) throws ScriptingException
{
if (logger.isDebugEnabled())
logger.debug("creating new ScriptManager");
// initialize the BSFManager
mgr = new BSFManager();
mgr.setTempDir(temp_dir);
@ -337,7 +340,7 @@ public class ScriptManager
lang = mgr.getLangFromFilename(filename);
code = IOUtil.loadText(file);
if (logger.isDebugEnabled())
logger.debug("Code language is " + lang);
logger.debug("Code language is " + lang + ", loaded " + code.length() + " characters");
} // end try
catch (BSFException e)
@ -352,7 +355,7 @@ public class ScriptManager
} // end catch
if (logger_name!=null) // push a new logger onto the stack
logger_stack.addFirst(Category.getInstance(logger_name));
logger_stack.addFirst(Logger.getLogger(logger_name));
if (sro!=null)
return_stack.addFirst(sro);

View File

@ -151,6 +151,10 @@ public abstract class BaseServlet extends HttpServlet
if (record_user)
NDC.push(the_request.getUser().getUserName());
// log start of request
if (logger.isDebugEnabled())
logger.debug("Begin Request: " + str_request);
try
{ // run the actual operation!
Object my_output; // the output we get from the user
@ -227,6 +231,10 @@ public abstract class BaseServlet extends HttpServlet
memlog.info("After: " + str_request + " Cur: " + r.totalMemory() + " Max: " + r.maxMemory() + " Free: "
+ r.freeMemory());
// log end of request
if (logger.isDebugEnabled())
logger.debug("End Request: " + str_request);
// make sure and pop the diagnostic context, if it was pushed
if (record_user)
NDC.pop();

View File

@ -454,6 +454,7 @@ public class RequestImpl implements RequestInput
*/
private static Logger logger = Logger.getLogger(RequestImpl.class);
private static int serial_gen = 1;
private static final String APP_ATTRIBUTE_STEM = "com.silverwrist.venice.ui.variables.";
@ -467,6 +468,7 @@ public class RequestImpl implements RequestInput
*--------------------------------------------------------------------------------
*/
private int serial; // serial number of this request
private ServletContext ctxt; // the servlet context
private HttpServletRequest request; // the servlet request data
private HttpServletResponse response; // the servlet response data
@ -504,6 +506,12 @@ public class RequestImpl implements RequestInput
this.engine = engine;
this.config = config;
synchronized (RequestImpl.class)
{ // add serial number
this.serial = serial_gen++;
} // end synchronized block
if (request.getMethod().equals("POST"))
{ // POSTs can have special handling for the request data
if (request.getContentType().startsWith("text/xml"))
@ -763,8 +771,9 @@ public class RequestImpl implements RequestInput
public String toString()
{
StringBuffer buf = new StringBuffer("{RequestImpl from [");
buf.append(request.getRemoteAddr()).append("] for ").append(request.getServletPath()).append("}");
StringBuffer buf = new StringBuffer("{RequestImpl #");
buf.append(serial).append("from [").append(request.getRemoteAddr()).append("] for ");
buf.append(request.getServletPath()).append("}");
return buf.toString();
} // end toString

View File

@ -11,7 +11,7 @@
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-04 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -30,7 +30,7 @@ public class ScriptExecServlet extends BaseServlet
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(ScriptExecServlet.class);
private static Logger logger = Logger.getLogger(ScriptExecServlet.class);
/*--------------------------------------------------------------------------------
* Implementations from class BaseServlet
@ -39,17 +39,31 @@ public class ScriptExecServlet extends BaseServlet
public Object process(RequestInput req) throws Exception, ThrowableContent
{
String str_req = req.toString();
if (logger.isDebugEnabled())
logger.debug("Begin ScriptExecServlet.process for " + str_req);
try
{ // get the script file name and logger name
ScriptSupport ssup = (ScriptSupport)(req.queryService(ScriptSupport.class));
String script_file = ssup.getScriptName(true);
String logger_name = ssup.getScriptLoggerName();
if (logger.isDebugEnabled())
logger.debug("EXECUTING " + script_file);
// execute it!
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
ScriptReturn sro = new ScriptReturn();
smgr.exec(new File(script_file),logger_name,sro);
return sro.get();
} // end try
finally
{ // output "end" message
if (logger.isDebugEnabled())
logger.debug("End ScriptExecServlet.process for " + str_req);
} // end finally
} // end process
} // end class ScriptExecServlet