本文整理了Java中com.ning.http.client.AsyncHttpClientConfig.getIOExceptionFilters()
方法的一些代码示例,展示了AsyncHttpClientConfig.getIOExceptionFilters()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AsyncHttpClientConfig.getIOExceptionFilters()
方法的具体详情如下:
包路径:com.ning.http.client.AsyncHttpClientConfig
类名称:AsyncHttpClientConfig
方法名:getIOExceptionFilters
[英]Return the list of java.io.IOException
[中]返回java的列表。木卫一。IOException
代码示例来源:origin: com.ning/async-http-client
private FilterContext handleIoException(FilterContext fc) throws FilterException {
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
}
return fc;
}
代码示例来源:origin: com.ning/async-http-client
public Protocol(ChannelManager channelManager, AsyncHttpClientConfig config, NettyAsyncHttpProviderConfig nettyConfig,
NettyRequestSender requestSender) {
this.channelManager = channelManager;
this.config = config;
this.nettyConfig = nettyConfig;
this.requestSender = requestSender;
hasResponseFilters = !config.getResponseFilters().isEmpty();
hasIOExceptionFilters = !config.getIOExceptionFilters().isEmpty();
maxRedirectException = new MaxRedirectException("Maximum redirect reached: " + config.getMaxRedirects());
}
代码示例来源:origin: com.ning/async-http-client
if (!config.getIOExceptionFilters().isEmpty()) {
if (!requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
代码示例来源:origin: com.ning/async-http-client
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
if (requestSender.isClosed())
return;
Channel channel = ctx.getChannel();
channelManager.removeAll(channel);
try {
super.channelClosed(ctx, e);
} catch (Exception ex) {
LOGGER.trace("super.channelClosed", ex);
}
Object attribute = Channels.getAttribute(channel);
LOGGER.debug("Channel Closed: {} with attribute {}", channel, attribute);
if (attribute instanceof Callback) {
Callback callback = (Callback) attribute;
Channels.setAttribute(channel, callback.future());
callback.call();
} else if (attribute instanceof NettyResponseFuture<?>) {
NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute;
future.touch();
if (!config.getIOExceptionFilters().isEmpty()
&& requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
return;
protocol.onClose(future);
requestSender.handleUnexpectedClosedChannel(channel, future);
}
}
代码示例来源:origin: com.ning/async-http-client
public boolean applyIoExceptionFiltersAndReplayRequest(NettyResponseFuture<?> future, IOException e, Channel channel)
throws IOException {
boolean replayed = false;
@SuppressWarnings({ "unchecked", "rawtypes" })
FilterContext<?> fc = new FilterContext.FilterContextBuilder().asyncHandler(future.getAsyncHandler()).request(future.getRequest())
.ioException(e).build();
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
try {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
} catch (FilterException efe) {
abort(channel, future, efe);
}
}
if (fc.replayRequest() && future.canBeReplayed()) {
replayRequest(future, fc, channel);
replayed = true;
}
return replayed;
}
代码示例来源:origin: com.ning/async-http-client
ioExceptionFilters.addAll(prototype.getIOExceptionFilters());
代码示例来源:origin: com.ning/async-http-client
logger.debug(t.getMessage(), t);
if (t instanceof IOException && !config.getIOExceptionFilters().isEmpty()) {
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler)
.request(request).ioException(IOException.class.cast(t)).build();
代码示例来源:origin: io.gatling/async-http-client
private FilterContext handleIoException(FilterContext fc) throws FilterException {
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
}
return fc;
}
代码示例来源:origin: io.gatling/async-http-client
private FilterContext handleIoException(FilterContext fc) throws FilterException {
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
}
return fc;
}
}
代码示例来源:origin: io.gatling/async-http-client
public Protocol(ChannelManager channelManager, AsyncHttpClientConfig config, NettyAsyncHttpProviderConfig nettyConfig,
NettyRequestSender requestSender) {
this.channelManager = channelManager;
this.config = config;
this.nettyConfig = nettyConfig;
this.requestSender = requestSender;
hasResponseFilters = !config.getResponseFilters().isEmpty();
hasIOExceptionFilters = !config.getIOExceptionFilters().isEmpty();
timeConverter = config.getTimeConverter();
}
代码示例来源:origin: io.gatling/async-http-client
if (!config.getIOExceptionFilters().isEmpty())
if (requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
return;
代码示例来源:origin: io.gatling/async-http-client
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
if (requestSender.isClosed())
return;
Channel channel = ctx.getChannel();
channelManager.removeAll(channel);
try {
super.channelClosed(ctx, e);
} catch (Exception ex) {
LOGGER.trace("super.channelClosed", ex);
}
Object attribute = Channels.getAttribute(channel);
LOGGER.debug("Channel Closed: {} with attribute {}", channel, attribute);
if (attribute instanceof Callback) {
Callback callback = (Callback) attribute;
Channels.setAttribute(channel, callback.future());
callback.call();
} else if (attribute instanceof NettyResponseFuture<?>) {
NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute;
future.touch();
if (!config.getIOExceptionFilters().isEmpty()
&& requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
return;
protocol.onClose(channel);
if (future == null || future.isDone())
channelManager.closeChannel(channel);
else if (!requestSender.retry(future, ctx.getChannel()))
requestSender.abort(future, REMOTELY_CLOSED_EXCEPTION);
}
}
代码示例来源:origin: io.gatling/async-http-client
public boolean applyIoExceptionFiltersAndReplayRequest(NettyResponseFuture<?> future, IOException e, Channel channel)
throws IOException {
boolean replayed = false;
@SuppressWarnings({ "unchecked", "rawtypes" })
FilterContext<?> fc = new FilterContext.FilterContextBuilder().asyncHandler(future.getAsyncHandler()).request(future.getRequest())
.ioException(e).build();
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
try {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
} catch (FilterException efe) {
abort(future, efe);
}
}
if (fc.replayRequest() && future.canBeReplayed()) {
replayRequest(future, fc, channel);
replayed = true;
}
return replayed;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
ioExceptionFilters.addAll(prototype.getIOExceptionFilters());
代码示例来源:origin: io.gatling/async-http-client
logger.debug(t.getMessage(), t);
if (t instanceof IOException && !config.getIOExceptionFilters().isEmpty()) {
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler)
.request(request).ioException(IOException.class.cast(t)).build();
代码示例来源:origin: io.gatling/async-http-client
ioExceptionFilters.addAll(prototype.getIOExceptionFilters());
代码示例来源:origin: javaee/grizzly-ahc
ioExceptionFilters.addAll(prototype.getIOExceptionFilters());
代码示例来源:origin: io.gatling/async-http-client
if (t instanceof IOException && !config.getIOExceptionFilters().isEmpty()) {
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler)
.request(future.getRequest()).ioException(IOException.class.cast(t)).build();
内容来源于网络,如有侵权,请联系作者删除!