org.glassfish.grizzly.Connection.setReadTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.glassfish.grizzly.Connection.setReadTimeout()方法的一些代码示例,展示了Connection.setReadTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.setReadTimeout()方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:setReadTimeout

Connection.setReadTimeout介绍

[英]Specifies the timeout for the blocking reads. This may be overridden on a per-connection basis. A value of zero or less effectively disables the timeout.
[中]指定阻塞读取的超时时间。这可能会在每个连接的基础上被覆盖。零或更小的值有效地禁用超时。

代码示例

代码示例来源:origin: javaee/grizzly

@Override
  public void completed(final Connection connection) {
    connection.configureStandalone(true);
    connection.setReadTimeout(10, TimeUnit.SECONDS);
  }
}));

代码示例来源:origin: javaee/grizzly

@Override
  public NextAction handleRead(FilterChainContext ctx)
      throws IOException {
    String message = ctx.getMessage();
    logger.log(Level.INFO, "First chunk come: {0}", message);
    intermResultQueue.add(message);
    Connection connection = ctx.getConnection();
    connection.setReadTimeout(10, TimeUnit.SECONDS);
    try {
      final ReadResult rr = ctx.read();
      intermResultQueue.add(rr);
    } catch (Exception e) {
      intermResultQueue.add(e);
    }
    return ctx.getStopAction();
  }
});

代码示例来源:origin: javaee/grizzly

@Override
  public NextAction handleRead(FilterChainContext ctx)
      throws IOException {
    String message = ctx.getMessage();
    logger.log(Level.INFO, "First chunk come: {0}", message);
    intermResultQueue.add(message);
    Connection connection = ctx.getConnection();
    connection.setReadTimeout(10, TimeUnit.SECONDS);
    for (int i = 0; i < clientMsgs.length - 1; i++) {
      final ReadResult rr = ctx.read();
      final String blckMsg = (String) rr.getMessage();
      rr.recycle();
      logger.log(Level.INFO, "Blocking chunk come: {0}", blckMsg);
      intermResultQueue.add(blckMsg);
      message += blckMsg;
    }
    ctx.setMessage(message);
    return ctx.getInvokeAction();
  }
});

代码示例来源:origin: javaee/grizzly

@Override
  public NextAction handleRead(FilterChainContext ctx)
      throws IOException {
    String message = ctx.getMessage();
    logger.log(Level.INFO, "First chunk come: {0}", message);
    intermResultQueue.add(message);
    Connection connection = ctx.getConnection();
    connection.setReadTimeout(10, TimeUnit.SECONDS);
    for (int i = 0; i < clientMsgs.length - 1; i++) {
      final ReadResult rr = ctx.read();
      final String blckMsg = (String) rr.getMessage();
      rr.recycle();
      logger.log(Level.INFO, "Blocking chunk come: {0}", blckMsg);
      intermResultQueue.add(blckMsg);
      message += blckMsg;
    }
    ctx.setMessage(message);
    return ctx.getInvokeAction();
  }
});

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: org.glassfish.grizzly/grizzly-core

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: javaee/grizzly

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

connection.setReadTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
connection.setReadTimeout(oldReadTimeout, TimeUnit.MILLISECONDS);

相关文章