public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if ((request instanceof HttpServletRequest)
&& (response instanceof HttpServletResponse)) {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
if (isSessionControlRequiredForThisResource(httpServletRequest)) {
if (isSessionInvalid(httpServletRequest)) {
String encodedURL = httpServletRequest.getContextPath() + this.timeoutPage;
try {
httpServletResponse.sendRedirect(encodedURL);
} catch (Exception e) {
logger.error("[Error happened in filter] : ", e.fillInStackTrace());
}
return;
}
}
if (!httpServletRequest.getRequestURI().startsWith(httpServletRequest.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) {
httpServletResponse.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
httpServletResponse.setHeader("Pragma", "no-cache");
httpServletResponse.setDateHeader("Expires", 0);
}
}
chain.doFilter(request, response);
}
上面显示的代码可能会在执行任务期间失败,导致SystemOut.log
中显示以下错误。是否有诊断WebSphere中发生线程挂起的做法?
[13年8月26日8:38:39:873 MYT] 0000002c ThreadMonitorW¯¯WSVR0605W:螺纹 “Web容器:9”(00000037)已活跃611221毫秒 并且可以被挂起。总共有7个线程在服务器中,可能会挂起 。
诊断这个错误并不容易,因为这总是会跟随一个非常长的堆栈跟踪列表,它不属于我的应用程序。通常它可能会在特定的时间段(大约15到20分钟)内发生几次,但线程ID可能不同。
我无法在UAT服务器的单元测试中模拟这个,我不确定这个问题的根本原因是什么。它偶尔会发生。有没有一种模式来捕捉这个错误?这是否发生在发生其他异常之后,说数据库连接已经丢失,或者可能是一些后台进程正在运行,比如说在生产服务器中检索巨大的结果集?我只是想了解什么情况会导致这个问题,以便在编码时避免这种情况。
您是否手动创建线程orso? – BalusC
没有。我确信应用程序中没有线程。 – huahsin68