2016-04-01 17 views
1

Apache Connector sağlayıcısı kullanarak Jersey Client ürününü kullanarak Geri arama servisi. POST, GET ve DELETE çağrılarım başarılı. Ancak, DELETE hesabını aradıktan sonra, sonraki çağrılar asılıdır.Jersey İstemcisi DELETE ikinci görüşmeyi askıya alır

İşte kodum. Aşağıdaki durumda ikinci DELETE çağrısı asılıyor. Yanlış yapabileceklerimin herhangi bir yönü yardımcı olur ..?

ClientConfig clientConfig = new ClientConfig(); 
clientConfig.connectorProvider(new ApacheConnectorProvider()); 
Cleint client = ClientBuilder.newClient(clientConfig); 

Response response = client.target("https://hostname/rest") 
      .path("account") 
      .path(accountId) 
      .request(MediaType.APPLICATION_JSON_TYPE) 
      .delete(); 

response = client.target("https://hostname/rest") 
      .path("account") 
      .path(accountId) 
      .path("user").path(userId) 
      .request(MediaType.APPLICATION_JSON_TYPE) 
      .delete(); 

cevap

1

Yanıtınızı yanıtladıktan sonra kapatmanız gerekir.

Response response = client.target("https://hostname/rest") 
     .path("account") 
     .path(accountId) 
     .request(MediaType.APPLICATION_JSON_TYPE) 
     .delete(); 
response.close(); 
response = client.target("https://hostname/rest") 
     .path("account") 
     .path(accountId) 
     .path("user").path(userId) 
     .request(MediaType.APPLICATION_JSON_TYPE) 
     .delete(); 
+0

Çok teşekkürler, bu yardımcı oldu. –