小编Pau*_*aft的帖子

WebSphere 7 HTTPSession实现是否违反了J2EE规范?

最近看到一个问题,所有200个Web容器线程都挂起了,这意味着没有任何服务可以为传入的请求提供服务,因此应用程序冻结了.

这是一个简单的Web应用程序和JMeter测试,我认为这证明了这个问题的原因.Web应用程序由两个类组成,即以下servlet:

public class SessionTestServlet extends HttpServlet {

    protected static final String SESSION_KEY = "session_key";

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        // set data on session so the listener is invoked
        String sessionData = new String("Session data");
        request.getSession().setAttribute(SESSION_KEY, sessionData);
        PrintWriter writer = response.getWriter();                           
        writer.println("<html><body>OK</body></html>");                      
        writer.flush();
        writer.close();
    }
}
Run Code Online (Sandbox Code Playgroud)

以及HttpSessionListener和HTTPSessionAttributeListener的以下实现:

public class SessionTestListener implements 
        HttpSessionListener, HttpSessionAttributeListener {

    private static final ConcurrentMap<String, HttpSession> allSessions 
        = new ConcurrentHashMap<String, HttpSession>(); 

    public void attributeRemoved(HttpSessionBindingEvent hsbe) {}

    public void attributeAdded(HttpSessionBindingEvent hsbe) { …
Run Code Online (Sandbox Code Playgroud)

java websphere deadlock java-ee

12
推荐指数
1
解决办法
3213
查看次数

标签 统计

deadlock ×1

java ×1

java-ee ×1

websphere ×1