de.mklinger.qetcher.client.impl.lookup.NodeLookupQetcherClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qetcher-client-bundle Show documentation
Show all versions of qetcher-client-bundle Show documentation
Qetcher Java client, OSGi bundle, minimal dependencies
package de.mklinger.qetcher.client.impl.lookup;
import de.mklinger.micro.closeables.Closeables;
import de.mklinger.qetcher.client.impl.QetcherClientBuilderImpl;
import de.mklinger.qetcher.client.impl.retry.RetryingQetcherClientImpl;
/**
* @author Marc Klinger - mklinger[at]mklinger[dot]de
*/
public class NodeLookupQetcherClientImpl extends RetryingQetcherClientImpl {
private final ScheduledNodesLookup nodesLookup;
public NodeLookupQetcherClientImpl(final QetcherClientBuilderImpl builder) {
super(builder, newDynamicServiceUriSupplier(builder));
this.nodesLookup = new ScheduledNodesLookup(
this,
getServiceUriSupplier().getNodesHolder());
this.nodesLookup.startDelayed();
}
private static ServiceUriSupplier newDynamicServiceUriSupplier(final QetcherClientBuilderImpl builder) {
return new DynamicServiceUriSupplier(builder.getServiceUris());
}
@Override
public DynamicServiceUriSupplier getServiceUriSupplier() {
return (DynamicServiceUriSupplier) super.getServiceUriSupplier();
}
@Override
public void close() {
Closeables.closeUnchecked(nodesLookup, super::close);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy