javax.ws.rs.container.AsyncResponse.isSuspended()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(39)

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

AsyncResponse.isSuspended介绍

[英]Check if the asynchronous response instance is in a suspended state. Method returns true if this asynchronous response is still suspended and has not finished processing yet (either by resuming or canceling the response).
[中]检查异步响应实例是否处于挂起状态。如果此异步响应仍然挂起且尚未完成处理(通过恢复或取消响应),则方法返回true。

代码示例

代码示例来源:origin: apache/cxf

@Override
public void onNext(T bean) {
  if (asyncTimeout > 0 && getAsyncResponse().isSuspended()) {
    resumeAsyncResponse();
  }
  queue.add(bean);
  super.requestNext();
}
private class StreamingResponseImpl implements StreamingResponse<T> {

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-extension-reactivestreams

@Override
public void onNext(T bean) {
  if (asyncTimeout > 0 && getAsyncResponse().isSuspended()) {
    resumeAsyncResponse();
  }
  queue.add(bean);
  super.requestNext();
}
private class StreamingResponseImpl implements StreamingResponse<T> {

代码示例来源:origin: org.realityforge.replicant/replicant-server

private void doPoll()
 {
  final Iterator<SuspendedRequest> iterator = _requests.values().iterator();
  while ( iterator.hasNext() )
  {
   final SuspendedRequest request = iterator.next();
   if ( !request.getResponse().isSuspended() || request.getResponse().isCancelled() )
   {
    iterator.remove();
   }
   else
   {
    try
    {
     final String data = _source.poll( request.getSessionID(), request.getRxSequence() );
     if ( null != data )
     {
      resume( request.getResponse(), data );
      iterator.remove();
     }
    }
    catch ( final Exception e )
    {
     handleException( request.getSessionID(), request.getResponse(), e );
     iterator.remove();
    }
   }
  }
 }
}

相关文章