com.windowsazure.messaging.HttpClientManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of NotificationHubs Show documentation
Show all versions of NotificationHubs Show documentation
This package contains the JAVA SDK for Azure Notification Hubs.
The newest version!
package com.windowsazure.messaging;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
public class HttpClientManager {
private static CloseableHttpAsyncClient httpAsyncClient;
public static CloseableHttpAsyncClient getHttpAsyncClient() {
if(httpAsyncClient == null) {
synchronized(HttpClientManager.class) {
if(httpAsyncClient == null) {
CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
client.start();
httpAsyncClient = client;
}
}
}
return httpAsyncClient;
}
public static void setHttpAsyncClient(CloseableHttpAsyncClient httpAsyncClient) {
synchronized(HttpClientManager.class) {
if(HttpClientManager.httpAsyncClient == null) {
HttpClientManager.httpAsyncClient = httpAsyncClient;
}
else{
throw new RuntimeException("HttpAsyncClient was already set before or default one is being used.");
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy