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

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

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

Connection.closeWithReason介绍

[英]Gracefully closes the Connection and provides the reason description. This method is similar to #closeSilently(), but additionally provides the reason why the Connection will be closed.
[中]优雅地关闭连接并提供原因说明。此方法类似于#close静默(),但还提供了关闭连接的原因。

代码示例

代码示例来源:origin: com.ning/async-http-client

private void feederFlush0(final Connection c) {
  try {
    feeder.flush();
  } catch (IOException ioe) {
    c.closeWithReason(ioe);
  }
}

代码示例来源:origin: com.ning/async-http-client

@Override
public void onFailure(final Connection connection, final Throwable t) {
  connection.closeWithReason(Exceptions.makeIOException(t));
}

代码示例来源:origin: com.ning/async-http-client

void timeout(final Connection c) {
  final HttpTransactionContext tx = HttpTransactionContext.currentTransaction(c);
  final TimeoutException te = new TimeoutException("Timeout exceeded");
  if (tx != null) {
    tx.abort(te);
  }
  
  c.closeWithReason(new IOException("Timeout exceeded", te));
}

代码示例来源:origin: com.ning/async-http-client

@Override
public void onError(Throwable t) {
  c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
  c.closeWithReason(Exceptions.makeIOException(t));
}

代码示例来源:origin: com.ning/async-http-client

private static void block(final Connection c,
             final FutureImpl<Boolean> future) {
  try {
    final long writeTimeout =
        c.getTransport().getWriteTimeout(MILLISECONDS);
    if (writeTimeout != -1) {
      future.get(writeTimeout, MILLISECONDS);
    } else {
      future.get();
    }
  } catch (ExecutionException e) {
    c.closeWithReason(Exceptions.makeIOException(e.getCause()));
  } catch (Exception e) {
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}

代码示例来源:origin: com.ning/async-http-client

@Override
public void ready() {
  try {
    flush();
  } catch (IOException e) {
    final Connection c = feedableBodyGenerator.context.getConnection();
    c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}

代码示例来源:origin: com.ning/async-http-client

@Override
  public void completed(HttpTransactionContext context) {
    if (!context.isReuseConnection()) {
      final Connection c = (Connection) httpContext.getCloseable();
      if (!httpContext.getRequest().getProcessingState().isStayAlive()) {
        if (notKeepAliveReason == null) {
          notKeepAliveReason
              = new IOException("HTTP keep-alive was disabled for this connection");
        }
        c.closeWithReason(notKeepAliveReason);
      } else {
        final ConnectionManager cm = context.provider.getConnectionManager();
        cm.returnConnection(c);
      }
    }
  }
});

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

@Override
public void onFailure(final Connection connection, final Throwable t) {
  connection.closeWithReason(Exceptions.makeIOException(t));
}

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

private void feederFlush0(final Connection c) {
  try {
    feeder.flush();
  } catch (IOException ioe) {
    c.closeWithReason(ioe);
  }
}

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

private void feederFlush0(final Connection c) {
  try {
    feeder.flush();
  } catch (IOException ioe) {
    c.closeWithReason(ioe);
  }
}

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

private void feederFlush0(final Connection c) {
  try {
    feeder.flush();
  } catch (IOException ioe) {
    c.closeWithReason(ioe);
  }
}

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

@Override
public void onFailure(final Connection connection, final Throwable t) {
  connection.closeWithReason(Exceptions.makeIOException(t));
}

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

void timeout(final Connection c) {
  final HttpTransactionContext tx = HttpTransactionContext.currentTransaction(c);
  final TimeoutException te = new TimeoutException("Timeout exceeded");
  if (tx != null) {
    tx.abort(te);
  }
  
  c.closeWithReason(new IOException("Timeout exceeded", te));
}

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

void timeout(final Connection c) {
  final HttpTransactionContext tx = HttpTransactionContext.currentTransaction(c);
  final TimeoutException te = new TimeoutException("Timeout exceeded");
  if (tx != null) {
    tx.abort(te);
  }
  
  c.closeWithReason(new IOException("Timeout exceeded", te));
}

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

@Override
public void onError(Throwable t) {
  c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
  c.closeWithReason(Exceptions.makeIOException(t));
}

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

@Override
public void onError(Throwable t) {
  c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
  c.closeWithReason(Exceptions.makeIOException(t));
}

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

@Override
public void onError(Throwable t) {
  c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
  c.closeWithReason(Exceptions.makeIOException(t));
}

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

@Override
public void ready() {
  try {
    flush();
  } catch (IOException e) {
    final Connection c = feedableBodyGenerator.context.getConnection();
    c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}

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

@Override
public void ready() {
  try {
    flush();
  } catch (IOException e) {
    final Connection c = feedableBodyGenerator.context.getConnection();
    c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}

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

@Override
public void ready() {
  try {
    flush();
  } catch (IOException e) {
    final Connection c = feedableBodyGenerator.context.getConnection();
    c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}

相关文章