You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 12, 2024. It is now read-only.
This repo is no longer actively maintained. While it should continue to work and there are no major known bugs, we will not be improving dns-java or releasing new versions.
spotify-dns-java
This small DNS wrapper library provides some useful pieces of functionality related to SRV lookups.
Resilience
Sometimes it is useful to default to previously returned, retained values, if a dns lookup should
fail or return an empty result. This behavior is controlled by the retainingDataOnFailures()
and retentionDurationMillis(long) methods in
DnsSrvResolvers.DnsSrvResolverBuilder.
Watching for Changes
It's often useful to update where you try to connect based on changes in lookup results, and this library
provides functionality that allows you to get notified when things change by implementing this interface (defined in the ChangeNotifier interface):
interfaceListener<T> {
/** * Signal that set of records changed. * * @param changeNotification An object containing details about the change */voidonChange(ChangeNotification<T> changeNotification);
}
/** * A change event containing the current and previous set of records. */interfaceChangeNotification<T> {
Set<T> current();
Set<T> previous();
}
If you have a statistics system that can be integrated with using the munin protocol, the method
metered() in DnsSrvResolvers.DnsSrvResolverBuilder enables this in conjunction with the spotify
munin forwarder. Have a look at the
BasicUsage example for details on how to
set that up.