MCPcopy Index your code
hub / github.com/InterviewReady/Low-Level-Design / balanceLoad

Method balanceLoad

LoadBalancer.java:35–40  ·  view source on GitHub ↗
(Request request)

Source from the content-addressed store, hash-verified

33class RoutedLoadBalancer extends LoadBalancer {
34
35 @Override
36 Destination balanceLoad(Request request) {
37 Set<Destination> destinations = getDestinations(request);
38 List<Destination> list = destinations.stream().collect(Collectors.toList());
39 return list.get(request.id.hashCode() % list.size());
40 }
41}
42
43class RoundRobinLoadBalancer extends LoadBalancer {

Callers

nothing calls this directly

Calls 3

getDestinationsMethod · 0.80
getMethod · 0.80
hashCodeMethod · 0.45

Tested by

no test coverage detected