-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Thanks for your code
I use it in my j2ee application in Wildfly 10 I did few changes the most important is close the response after using it ( otherwise this exception is thrown 'Caused by: java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.' )
My snippet of WnsClient push method
Response response = webResourceBuilder
.buildPost(Entity.entity(resourceBuilder.getEntityToSendWithNotification(notification), type)).invoke();
WnsNotificationResponse notificationResponse = null;
try {
notificationResponse = new WnsNotificationResponse(channelUri, response.getStatus(),
response.getStringHeaders());
if (notificationResponse.code == 200) {
return notificationResponse;
}
if (notificationResponse.code == 401 && retriesLeft > 0) {
retriesLeft--;
// Access token may have expired
refreshAccessToken();
// Retry
return this.push(resourceBuilder, channelUri, notification, retriesLeft, optional);
}
} finally {
if (response != null) {
// EntityUtils.consume((HttpEntity) response.getEntity());
//EntityUtils.consumeQuietly((HttpEntity) response.getEntity());
response.close();
}
}
best regards
Alberto
Metadata
Metadata
Assignees
Labels
No labels