本文整理了Java中javax.ws.rs.client.Client.close()
方法的一些代码示例,展示了Client.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.close()
方法的具体详情如下:
包路径:javax.ws.rs.client.Client
类名称:Client
方法名:close
[英]Close client instance and all it's associated resources. Subsequent calls have no effect and are ignored. Once the client is closed, invoking any other method on the client instance would result in an IllegalStateExceptionbeing thrown.
Calling this method effectively invalidates all WebTargetproduced by the client instance. Invoking any method on such targets once the client is closed would result in an IllegalStateException being thrown.
[中]关闭客户端实例及其所有关联资源。后续调用无效,将被忽略。一旦客户机关闭,调用客户机实例上的任何其他方法将导致抛出IllegalStateException。
调用此方法将有效地使客户端实例生成的所有WebTarget无效。一旦客户机关闭,在这些目标上调用任何方法都会导致抛出IllegalStateException。
代码示例来源:origin: dropwizard/dropwizard
@Override
public void stop() throws Exception {
client.close();
}
});
代码示例来源:origin: Netflix/eureka
@Override
public void shutdown() {
jersey2Client.close();
}
代码示例来源:origin: apache/storm
public void cleanup() {
client.close();
}
代码示例来源:origin: confluentinc/ksql
@Override
public void close() {
client.close();
}
代码示例来源:origin: spotify/docker-client
@Override
public void close() {
client.close();
noTimeoutClient.close();
}
代码示例来源:origin: apache/nifi
@Override
public void close() throws IOException {
if (this.client != null) {
try {
this.client.close();
} catch (Exception e) {
}
}
}
代码示例来源:origin: Netflix/eureka
/**
* Clean up resources.
*/
@Override
public void destroyResources() {
if (eurekaConnCleaner != null) {
// Execute the connection cleaner one final time during shutdown
eurekaConnCleaner.execute(connectionCleanerTask);
eurekaConnCleaner.shutdown();
}
if (apacheHttpClient != null) {
apacheHttpClient.close();
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void after() {
if (recursiveCallCount.decrementAndGet() == 0) {
testSupport.after();
synchronized (this) {
if (client != null) {
client.close();
}
}
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
protected void after() {
if (recursiveCallCount.decrementAndGet() == 0) {
testSupport.after();
synchronized (this) {
if (client != null) {
client.close();
}
}
}
}
代码示例来源:origin: jersey/jersey
/**
* Utility method that safely closes a client instance without throwing an exception.
*
* @param clients client instances to close. Each instance may be {@code null}.
* @since 2.5
*/
public static void closeIfNotNull(final Client... clients) {
if (clients == null || clients.length == 0) {
return;
}
for (final Client c : clients) {
if (c == null) {
continue;
}
try {
c.close();
} catch (final Throwable t) {
LOGGER.log(Level.WARNING, "Error closing a client instance.", t);
}
}
}
代码示例来源:origin: jersey/jersey
@TearDown
public void shutdown() {
client.close();
}
代码示例来源:origin: docker-java/docker-java
@Override
public void close() throws IOException {
checkNotNull(client, "Factory not initialized. You probably forgot to call init()!");
client.close();
connManager.close();
}
代码示例来源:origin: apache/nifi
@OnStopped
public void destroyClient() {
if (client != null) {
client.close();
}
}
代码示例来源:origin: spotify/apollo
@Override
public void close() throws IOException {
if (!Strings.isNullOrEmpty(slackConfig.shutdownMsg())) {
post(slackConfig.shutdownMsg());
}
client.close();
}
}
代码示例来源:origin: jersey/jersey
client.close();
代码示例来源:origin: confluentinc/ksql
@After
public void cleanUp() {
restClient.close();
}
代码示例来源:origin: jersey/jersey
client.close();
代码示例来源:origin: jamesagnew/hapi-fhir
@Override
protected void resetHttpClient() {
if (myNativeClient != null)
myNativeClient.close(); // close client to avoid memory leak
myNativeClient = null;
}
代码示例来源:origin: dadoonet/fscrawler
@AfterClass
public static void stopRestClient() throws IOException {
if (client != null) {
client.close();
client = null;
}
if (esClient != null) {
esClient.close();
esClient = null;
}
}
代码示例来源:origin: confluentinc/kafka-streams-examples
@After
public void tearDown() {
services.forEach(Service::stop);
stopTailers();
CLUSTER.stop();
if (client != null) {
client.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!