本文整理了Java中io.airlift.http.client.HttpClient.isClosed()
方法的一些代码示例,展示了HttpClient.isClosed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.isClosed()
方法的具体详情如下:
包路径:io.airlift.http.client.HttpClient
类名称:HttpClient
方法名:isClosed
暂无
代码示例来源:origin: prestodb/presto
@Override
public void onFailure(Throwable t)
{
if (t instanceof RejectedExecutionException && httpClient.isClosed()) {
logError(t, "Unable to %s task at %s. HTTP client is closed.", action, request.getUri());
cleanUpLocally();
return;
}
// record failure
if (cleanupBackoff.failure()) {
logError(t, "Unable to %s task at %s. Back off depleted.", action, request.getUri());
cleanUpLocally();
return;
}
// reschedule
long delayNanos = cleanupBackoff.getBackoffDelayNanos();
if (delayNanos == 0) {
doScheduleAsyncCleanupRequest(cleanupBackoff, request, action);
}
else {
errorScheduledExecutor.schedule(() -> doScheduleAsyncCleanupRequest(cleanupBackoff, request, action), delayNanos, NANOSECONDS);
}
}
代码示例来源:origin: airlift/airlift
@Test
public void testClientShutdown()
throws Exception
{
Injector injector = new Bootstrap(
binder -> {
httpClientBinder(binder).bindHttpClient("foo", FooClient.class);
httpClientBinder(binder).bindHttpClient("bar", BarClient.class);
})
.quiet()
.strictConfig()
.initialize();
HttpClient fooClient = injector.getInstance(Key.get(HttpClient.class, FooClient.class));
HttpClient barClient = injector.getInstance(Key.get(HttpClient.class, BarClient.class));
assertFalse(fooClient.isClosed());
assertFalse(barClient.isClosed());
injector.getInstance(LifeCycleManager.class).stop();
assertTrue(fooClient.isClosed());
assertTrue(barClient.isClosed());
}
代码示例来源:origin: io.airlift/http-client
@Test
public void testClientShutdown()
throws Exception
{
Injector injector = new Bootstrap(
binder -> {
httpClientBinder(binder).bindHttpClient("foo", FooClient.class);
httpClientBinder(binder).bindHttpClient("bar", BarClient.class);
})
.quiet()
.strictConfig()
.initialize();
HttpClient fooClient = injector.getInstance(Key.get(HttpClient.class, FooClient.class));
HttpClient barClient = injector.getInstance(Key.get(HttpClient.class, BarClient.class));
assertFalse(fooClient.isClosed());
assertFalse(barClient.isClosed());
injector.getInstance(LifeCycleManager.class).stop();
assertTrue(fooClient.isClosed());
assertTrue(barClient.isClosed());
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public void onFailure(Throwable t)
{
if (t instanceof RejectedExecutionException && httpClient.isClosed()) {
logError(t, "Unable to %s task at %s. HTTP client is closed.", action, request.getUri());
cleanUpLocally();
return;
}
// record failure
if (cleanupBackoff.failure()) {
logError(t, "Unable to %s task at %s. Back off depleted.", action, request.getUri());
cleanUpLocally();
return;
}
// reschedule
long delayNanos = cleanupBackoff.getBackoffDelayNanos();
if (delayNanos == 0) {
doScheduleAsyncCleanupRequest(cleanupBackoff, request, action);
}
else {
errorScheduledExecutor.schedule(() -> doScheduleAsyncCleanupRequest(cleanupBackoff, request, action), delayNanos, NANOSECONDS);
}
}
代码示例来源:origin: prestosql/presto
@Override
public void onFailure(Throwable t)
{
if (t instanceof RejectedExecutionException && httpClient.isClosed()) {
logError(t, "Unable to %s task at %s. HTTP client is closed.", action, request.getUri());
cleanUpLocally();
return;
}
// record failure
if (cleanupBackoff.failure()) {
logError(t, "Unable to %s task at %s. Back off depleted.", action, request.getUri());
cleanUpLocally();
return;
}
// reschedule
long delayNanos = cleanupBackoff.getBackoffDelayNanos();
if (delayNanos == 0) {
doScheduleAsyncCleanupRequest(cleanupBackoff, request, action);
}
else {
errorScheduledExecutor.schedule(() -> doScheduleAsyncCleanupRequest(cleanupBackoff, request, action), delayNanos, NANOSECONDS);
}
}
内容来源于网络,如有侵权,请联系作者删除!