[hdpowerview] deferred instantiation of JAX-RS client (#9002)

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
Andrew Fiddian-Green 2020-11-12 03:49:27 +00:00 committed by GitHub
parent 5b7f1b0e67
commit 0856a0b3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,6 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -68,7 +67,6 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
private long refreshInterval;
private long hardRefreshInterval;
private final Client client = ClientBuilder.newClient();
private @Nullable HDPowerViewWebTargets webTargets;
private @Nullable ScheduledFuture<?> pollFuture;
private @Nullable ScheduledFuture<?> hardRefreshFuture;
@ -116,7 +114,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
return;
}
webTargets = new HDPowerViewWebTargets(client, host);
webTargets = new HDPowerViewWebTargets(ClientBuilder.newClient(), host);
refreshInterval = config.refresh;
hardRefreshInterval = config.hardRefresh;
schedulePoll();