additional tracery to track down the persistent OutOfMemoryError on EMinds
This commit is contained in:
parent
4550100675
commit
55db78c0e9
|
@ -73,21 +73,21 @@ public class ScriptManager
|
||||||
public void fatal(Object message)
|
public void fatal(Object message)
|
||||||
{
|
{
|
||||||
if (logger_stack.size()>0)
|
if (logger_stack.size()>0)
|
||||||
((Category)(logger_stack.getFirst())).fatal(message);
|
((Logger)(logger_stack.getFirst())).fatal(message);
|
||||||
|
|
||||||
} // end fatal
|
} // end fatal
|
||||||
|
|
||||||
public void error(Object message)
|
public void error(Object message)
|
||||||
{
|
{
|
||||||
if (logger_stack.size()>0)
|
if (logger_stack.size()>0)
|
||||||
((Category)(logger_stack.getFirst())).error(message);
|
((Logger)(logger_stack.getFirst())).error(message);
|
||||||
|
|
||||||
} // end error
|
} // end error
|
||||||
|
|
||||||
public void warn(Object message)
|
public void warn(Object message)
|
||||||
{
|
{
|
||||||
if (logger_stack.size()>0)
|
if (logger_stack.size()>0)
|
||||||
((Category)(logger_stack.getFirst())).warn(message);
|
((Logger)(logger_stack.getFirst())).warn(message);
|
||||||
|
|
||||||
} // end warn
|
} // end warn
|
||||||
|
|
||||||
|
@ -95,9 +95,9 @@ public class ScriptManager
|
||||||
{
|
{
|
||||||
if (logger_stack.size()>0)
|
if (logger_stack.size()>0)
|
||||||
{ // check to make sure info is enabled first
|
{ // check to make sure info is enabled first
|
||||||
Category cat = (Category)(logger_stack.getFirst());
|
Logger l = (Logger)(logger_stack.getFirst());
|
||||||
if (cat.isInfoEnabled())
|
if (l.isInfoEnabled())
|
||||||
cat.info(message);
|
l.info(message);
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
|
@ -107,9 +107,9 @@ public class ScriptManager
|
||||||
{
|
{
|
||||||
if (logger_stack.size()>0)
|
if (logger_stack.size()>0)
|
||||||
{ // check to make sure debug is enabled first
|
{ // check to make sure debug is enabled first
|
||||||
Category cat = (Category)(logger_stack.getFirst());
|
Logger l = (Logger)(logger_stack.getFirst());
|
||||||
if (cat.isDebugEnabled())
|
if (l.isDebugEnabled())
|
||||||
cat.debug(message);
|
l.debug(message);
|
||||||
|
|
||||||
} // end if
|
} // 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 Class[] fixupRhino_parmtypes = { Boolean.TYPE };
|
||||||
private static final Object[] fixupRhino_parms = { Boolean.FALSE };
|
private static final Object[] fixupRhino_parms = { Boolean.FALSE };
|
||||||
|
@ -150,6 +150,9 @@ public class ScriptManager
|
||||||
*/
|
*/
|
||||||
public ScriptManager(String temp_dir) throws ScriptingException
|
public ScriptManager(String temp_dir) throws ScriptingException
|
||||||
{
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("creating new ScriptManager");
|
||||||
|
|
||||||
// initialize the BSFManager
|
// initialize the BSFManager
|
||||||
mgr = new BSFManager();
|
mgr = new BSFManager();
|
||||||
mgr.setTempDir(temp_dir);
|
mgr.setTempDir(temp_dir);
|
||||||
|
@ -337,7 +340,7 @@ public class ScriptManager
|
||||||
lang = mgr.getLangFromFilename(filename);
|
lang = mgr.getLangFromFilename(filename);
|
||||||
code = IOUtil.loadText(file);
|
code = IOUtil.loadText(file);
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Code language is " + lang);
|
logger.debug("Code language is " + lang + ", loaded " + code.length() + " characters");
|
||||||
|
|
||||||
} // end try
|
} // end try
|
||||||
catch (BSFException e)
|
catch (BSFException e)
|
||||||
|
@ -352,7 +355,7 @@ public class ScriptManager
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
if (logger_name!=null) // push a new logger onto the stack
|
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)
|
if (sro!=null)
|
||||||
return_stack.addFirst(sro);
|
return_stack.addFirst(sro);
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,10 @@ public abstract class BaseServlet extends HttpServlet
|
||||||
if (record_user)
|
if (record_user)
|
||||||
NDC.push(the_request.getUser().getUserName());
|
NDC.push(the_request.getUser().getUserName());
|
||||||
|
|
||||||
|
// log start of request
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("Begin Request: " + str_request);
|
||||||
|
|
||||||
try
|
try
|
||||||
{ // run the actual operation!
|
{ // run the actual operation!
|
||||||
Object my_output; // the output we get from the user
|
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: "
|
memlog.info("After: " + str_request + " Cur: " + r.totalMemory() + " Max: " + r.maxMemory() + " Free: "
|
||||||
+ r.freeMemory());
|
+ 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
|
// make sure and pop the diagnostic context, if it was pushed
|
||||||
if (record_user)
|
if (record_user)
|
||||||
NDC.pop();
|
NDC.pop();
|
||||||
|
|
|
@ -454,6 +454,7 @@ public class RequestImpl implements RequestInput
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(RequestImpl.class);
|
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.";
|
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 ServletContext ctxt; // the servlet context
|
||||||
private HttpServletRequest request; // the servlet request data
|
private HttpServletRequest request; // the servlet request data
|
||||||
private HttpServletResponse response; // the servlet response data
|
private HttpServletResponse response; // the servlet response data
|
||||||
|
@ -504,6 +506,12 @@ public class RequestImpl implements RequestInput
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
|
synchronized (RequestImpl.class)
|
||||||
|
{ // add serial number
|
||||||
|
this.serial = serial_gen++;
|
||||||
|
|
||||||
|
} // end synchronized block
|
||||||
|
|
||||||
if (request.getMethod().equals("POST"))
|
if (request.getMethod().equals("POST"))
|
||||||
{ // POSTs can have special handling for the request data
|
{ // POSTs can have special handling for the request data
|
||||||
if (request.getContentType().startsWith("text/xml"))
|
if (request.getContentType().startsWith("text/xml"))
|
||||||
|
@ -763,8 +771,9 @@ public class RequestImpl implements RequestInput
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer("{RequestImpl from [");
|
StringBuffer buf = new StringBuffer("{RequestImpl #");
|
||||||
buf.append(request.getRemoteAddr()).append("] for ").append(request.getServletPath()).append("}");
|
buf.append(serial).append("from [").append(request.getRemoteAddr()).append("] for ");
|
||||||
|
buf.append(request.getServletPath()).append("}");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
||||||
} // end toString
|
} // end toString
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
* 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
|
* 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):
|
* 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
|
* Implementations from class BaseServlet
|
||||||
|
@ -39,16 +39,30 @@ public class ScriptExecServlet extends BaseServlet
|
||||||
|
|
||||||
public Object process(RequestInput req) throws Exception, ThrowableContent
|
public Object process(RequestInput req) throws Exception, ThrowableContent
|
||||||
{
|
{
|
||||||
ScriptSupport ssup = (ScriptSupport)(req.queryService(ScriptSupport.class));
|
String str_req = req.toString();
|
||||||
String script_file = ssup.getScriptName(true);
|
|
||||||
String logger_name = ssup.getScriptLoggerName();
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("EXECUTING " + script_file);
|
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);
|
||||||
|
|
||||||
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
|
// execute it!
|
||||||
ScriptReturn sro = new ScriptReturn();
|
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
|
||||||
smgr.exec(new File(script_file),logger_name,sro);
|
ScriptReturn sro = new ScriptReturn();
|
||||||
return sro.get();
|
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 process
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user