A lightweight service pool implementation with latency awareness.
A lightweight service pool implementation with latency awareness.
Usage:
type Host = Stringval pool = new LatencyAwareServicePool[Host]()
pool.setProviders(initialProvidersList)
def queryThing() = pool.execute { host =>
LOG.info(s"querying $host")
doQuery(host)
}
def renewProviderList(updatedProviders: Set[Host]) = pool.setProviders(updatedProviders)
When you provide an updated providers list, the service pool will compare the new list with
the current providers, preserving the statistics for hosts it already knows about, adding new hosts,
and dropping hosts that are not present in the new list.
T
The type of the service to track. Can be anything.
A lightweight service pool implementation with latency awareness.
Usage:
When you provide an updated providers list, the service pool will compare the new list with the current providers, preserving the statistics for hosts it already knows about, adding new hosts, and dropping hosts that are not present in the new list.
The type of the service to track. Can be anything.