mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[tapocontrol] Use createHttpClient (#14475)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
884b5e9e83
commit
fbf9a9e6a9
@ -27,6 +27,7 @@ import org.openhab.binding.tapocontrol.internal.device.TapoLightStrip;
|
||||
import org.openhab.binding.tapocontrol.internal.device.TapoSmartBulb;
|
||||
import org.openhab.binding.tapocontrol.internal.device.TapoSmartPlug;
|
||||
import org.openhab.binding.tapocontrol.internal.device.TapoUniversalDevice;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
@ -37,6 +38,7 @@ import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -54,9 +56,9 @@ public class TapoControlHandlerFactory extends BaseThingHandlerFactory {
|
||||
private final HttpClient httpClient;
|
||||
|
||||
@Activate
|
||||
public TapoControlHandlerFactory() {
|
||||
public TapoControlHandlerFactory(final @Reference HttpClientFactory httpClientFactory) {
|
||||
// create new httpClient
|
||||
httpClient = new HttpClient(new SslContextFactory.Client());
|
||||
httpClient = httpClientFactory.createHttpClient(BINDING_ID, new SslContextFactory.Client());
|
||||
httpClient.setFollowRedirects(false);
|
||||
httpClient.setMaxConnectionsPerDestination(HTTP_MAX_CONNECTIONS);
|
||||
httpClient.setMaxRequestsQueuedPerDestination(HTTP_MAX_QUEUED_REQUESTS);
|
||||
|
Loading…
Reference in New Issue
Block a user