1

我尝试了各种组合,但总是超时,我无法按照文档中的说明通过配置进行更改。

这是我的 web.xml 的一部分:

<servlet>
    <description>AtmosphereServlet</description>
    <servlet-name>AtmosphereServlet</servlet-name>
    <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.websocket.maxIdleTime</param-name>
        <!--10 minutes-->
        <param-value>600000</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.CometSupport.maxInactiveActivity</param-name>
        <!--10 minutes-->
        <param-value>600000</param-value>
    </init-param>
    <async-supported>true</async-supported>
    <load-on-startup>2</load-on-startup>
</servlet>

当我设置 org.atmosphere.websocket.maxIdleTime 时,超时是即时的,它根本不起作用。

更改 org.atmosphere.cpr.CometSupport.maxInactiveActivity 似乎没有影响。它总是在 1 分钟后超时。

我单独和一起尝试了每个参数。

timedout():424, AsynchronousProcessor {org.atmosphere.cpr}

我也试过:

  AtmosphereRequest req = r.getRequest();
  // First, tell Atmosphere
  // to allow bi-directional communication by suspending.
  if (req.getMethod().equalsIgnoreCase("GET"))
  {
     r.suspend(10 * 60 * 1000);
  }

谢谢!


更新 作为一种解决方法,我升级到 1.1.0.RC1 并使用了这个:

    <init-param>
        <param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
        <param-value>org.atmosphere.interceptor.HeartbeatInterceptor</param-value>
    </init-param>

这是一个很好的补充。

我仍然无法配置服务器端超时。

4

1 回答 1

1

请在 Github 上提交问题,以便为 RC2 修复。

于 2013-05-01T21:37:34.207 回答