当前位置: 首页>>代码示例>>Java>>正文


Java StreamResetException类代码示例

本文整理汇总了Java中okhttp3.internal.http2.StreamResetException的典型用法代码示例。如果您正苦于以下问题:Java StreamResetException类的具体用法?Java StreamResetException怎么用?Java StreamResetException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StreamResetException类属于okhttp3.internal.http2包,在下文中一共展示了StreamResetException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: streamFailed

import okhttp3.internal.http2.StreamResetException; //导入依赖的package包/类
public void streamFailed(IOException e) {
  Socket socket;
  boolean noNewStreams = false;

  synchronized (connectionPool) {
    if (e instanceof StreamResetException) {
      StreamResetException streamResetException = (StreamResetException) e;
      if (streamResetException.errorCode == ErrorCode.REFUSED_STREAM) {
        refusedStreamCount++;
      }
      // On HTTP/2 stream errors, retry REFUSED_STREAM errors once on the same connection. All
      // other errors must be retried on a new connection.
      if (streamResetException.errorCode != ErrorCode.REFUSED_STREAM || refusedStreamCount > 1) {
        noNewStreams = true;
        route = null;
      }
    } else if (connection != null
        && (!connection.isMultiplexed() || e instanceof ConnectionShutdownException)) {
      noNewStreams = true;

      // If this route hasn't completed a call, avoid it for new connections.
      if (connection.successCount == 0) {
        if (route != null && e != null) {
          routeSelector.connectFailed(route, e);
        }
        route = null;
      }
    }
    socket = deallocate(noNewStreams, false, true);
  }

  closeQuietly(socket);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:StreamAllocation.java

示例2: streamFailed

import okhttp3.internal.http2.StreamResetException; //导入依赖的package包/类
public void streamFailed(IOException e) {
  Socket socket;
  Connection releasedConnection;
  boolean noNewStreams = false;

  synchronized (connectionPool) {
    if (e instanceof StreamResetException) {
      StreamResetException streamResetException = (StreamResetException) e;
      if (streamResetException.errorCode == ErrorCode.REFUSED_STREAM) {
        refusedStreamCount++;
      }
      // On HTTP/2 stream errors, retry REFUSED_STREAM errors once on the same connection. All
      // other errors must be retried on a new connection.
      if (streamResetException.errorCode != ErrorCode.REFUSED_STREAM || refusedStreamCount > 1) {
        noNewStreams = true;
        route = null;
      }
    } else if (connection != null
        && (!connection.isMultiplexed() || e instanceof ConnectionShutdownException)) {
      noNewStreams = true;

      // If this route hasn't completed a call, avoid it for new connections.
      if (connection.successCount == 0) {
        if (route != null && e != null) {
          routeSelector.connectFailed(route, e);
        }
        route = null;
      }
    }
    releasedConnection = connection;
    socket = deallocate(noNewStreams, false, true);
    if (connection != null || !reportedAcquired) releasedConnection = null;
  }

  closeQuietly(socket);
  if (releasedConnection != null) {
    eventListener.connectionReleased(call, releasedConnection);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:StreamAllocation.java

示例3: streamFailed

import okhttp3.internal.http2.StreamResetException; //导入依赖的package包/类
public void streamFailed(IOException e) {
    boolean noNewStreams = false;

    synchronized (connectionPool) {
        if (e instanceof StreamResetException) {
            StreamResetException streamResetException = (StreamResetException) e;
            if (streamResetException.errorCode == ErrorCode.REFUSED_STREAM) {
                refusedStreamCount++;
            }
            // On HTTP/2 stream errors, retry REFUSED_STREAM errors once on the same connection. All
            // other errors must be retried on a new connection.
            if (streamResetException.errorCode != ErrorCode.REFUSED_STREAM || refusedStreamCount > 1) {
                noNewStreams = true;
                route = null;
            }
        } else if (connection != null && !connection.isMultiplexed()) {
            noNewStreams = true;

            // If this route hasn't completed a call, avoid it for new connections.
            if (connection.successCount == 0) {
                if (route != null && e != null) {
                    routeSelector.connectFailed(route, e);
                }
                route = null;
            }
        }
    }

    deallocate(noNewStreams, false, true);
}
 
开发者ID:RunningTheSnail,项目名称:Okhttp,代码行数:31,代码来源:StreamAllocation.java


注:本文中的okhttp3.internal.http2.StreamResetException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。