com.sun.jersey.api.client.Client.destroy()方法的使用及代码示例

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

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

Client.destroy介绍

[英]Destroy the client. Any system resources associated with the client will be cleaned up.

This method must be called when there are not responses pending otherwise undefined behavior will occur.

The client must not be reused after this method is called otherwise undefined behavior will occur.
[中]摧毁客户。将清理与客户端关联的所有系统资源。
当没有挂起的响应时,必须调用此方法,否则将发生未定义的行为。
调用此方法后,不得重用客户端,否则将发生未定义的行为。

代码示例

代码示例来源:origin: soabase/exhibitor

@Override
  public void close() throws IOException
  {
    client.destroy();
  }
}

代码示例来源:origin: apache/incubator-druid

public void close()
{
 flush();
 client.destroy();
 scheduler.shutdown();
}

代码示例来源:origin: pentaho/pentaho-kettle

client.destroy();

代码示例来源:origin: pentaho/pentaho-kettle

client.destroy();

代码示例来源:origin: org.apache.tez/tez-api

@Override
public void close() throws IOException {
 if (httpClient != null) {
  httpClient.destroy();
  httpClient = null;
 }
}

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

@Override
public void close() throws IOException {
  client.destroy();
}

代码示例来源:origin: com.sun.jersey/jersey-bundle

/**
 * Defer to {@link #destroy() }
 */
@Override
@SuppressWarnings("FinalizeDeclaration")
protected void finalize() throws Throwable {
  destroy();
  super.finalize();
}

代码示例来源:origin: org.apache.apex/malhar-library

@Override
public void teardown()
{
 if (wsClient != null) {
  wsClient.destroy();
 }
 super.teardown();
}

代码示例来源:origin: org.apache.apex/malhar-library

@Override
public void teardown()
{
 if (wsClient != null) {
  wsClient.destroy();
 }
 super.teardown();
}

代码示例来源:origin: sonia.net.ahc/jersey-ahc-client

@Override
protected void finalize() throws Throwable{
  try {
    // Do not close the AHCClient.
    super.destroy();
  } finally {
    super.finalize();            
  }
}

代码示例来源:origin: org.sonatype.spice/jersey-ahc-client

@Override
protected void finalize(){
  try {
    // Do not close the AHCClient.
    super.destroy();
  } finally {
    super.finalize();            
  }
}

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

@Override
public void cleanup() {
  try {
    this.client.getJerseyClient().destroy();
    this.client.close();
  } catch (IOException e) {
    LOG.error("Close client error: {}", e.getMessage(), e);
  } finally {
    super.cleanup();
  }
}

代码示例来源:origin: sonia.net.ahc/jersey-ahc-client

@Override
public void destroy(){
  try{
    clientHandler.getHttpClient().close();
  } finally {
    super.destroy();
  }
}

代码示例来源:origin: org.sonatype.spice/jersey-ahc-client

@Override
public void destroy(){
  try{
    clientHandler.getHttpClient().close();
  } finally {
    super.destroy();
  }
}

代码示例来源:origin: org.apache.atlas/atlas-client-common

void handleClientHandlerException(ClientHandlerException che) {
  if (isRetryableException(che)) {
    atlasClientContext.getClient().destroy();
    LOG.warn("Destroyed current context while handling ClientHandlerEception.");
    LOG.warn("Will retry and create new context.");
    sleepBetweenRetries();
    initializeState(atlasClientContext.getBaseUrls(), atlasClientContext.getUgi(),
        atlasClientContext.getDoAsUser());
    return;
  }
  throw che;
}

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

void handleClientHandlerException(ClientHandlerException che) {
  if (isRetryableException(che)) {
    atlasClientContext.getClient().destroy();
    LOG.warn("Destroyed current context while handling ClientHandlerEception.");
    LOG.warn("Will retry and create new context.");
    sleepBetweenRetries();
    initializeState(atlasClientContext.getBaseUrls(), atlasClientContext.getUgi(),
        atlasClientContext.getDoAsUser());
    return;
  }
  throw che;
}

代码示例来源:origin: apache/incubator-atlas

void handleClientHandlerException(ClientHandlerException che) {
  if (isRetryableException(che)) {
    atlasClientContext.getClient().destroy();
    LOG.warn("Destroyed current context while handling ClientHandlerEception.");
    LOG.warn("Will retry and create new context.");
    sleepBetweenRetries();
    initializeState(atlasClientContext.getBaseUrls(), atlasClientContext.getUgi(),
        atlasClientContext.getDoAsUser());
    return;
  }
  throw che;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-timelineservice

@Test
public void testGetEntityNotPresent() throws Exception {
 Client client = createClient();
 try {
  URI uri = URI.create("http://localhost:" + serverPort + "/ws/v2/" +
    "timeline/clusters/cluster1/apps/app1/entities/app/id_10");
  verifyHttpResponse(client, uri, Status.NOT_FOUND);
 } finally {
  client.destroy();
 }
}

代码示例来源:origin: mjiderhamn/classloader-leak-prevention

@Override
protected void triggerLeak() {
 Client client = ApacheHttpClient.create(new DefaultClientConfig());
 try {
  // it doesn't matter where we make our call, we only want to initiate connections to create the leak
  WebResource webResource = client.resource("http://localhost:1234");
  webResource.accept("application/json").get(ClientResponse.class);
 } catch (Throwable ex) {
  //exception thrown for a non existing url, we do not need to call a real url, only to start the relevant leaking classes 
 }
 client.destroy();
}

代码示例来源:origin: mjiderhamn/classloader-leak-prevention

@Override
protected void triggerLeak() {
 Client client = ApacheHttpClient.create(new DefaultClientConfig());
 try {
  // it doesn't matter where we make our call, we only want to initiate connections to create the leak
  WebResource webResource = client.resource("http://localhost:1234");
  webResource.accept("application/json").get(ClientResponse.class);
 } catch (Throwable ex) {
  //exception thrown for a non existing url, we do not need to call a real url, only to start the relevant leaking classes 
 }
 client.destroy();
}

相关文章