MCPcopy Create free account
hub / github.com/InterviewReady/Low-Level-Design / LoadBalancerFactory

Class LoadBalancerFactory

LoadBalancer.java:104–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104class LoadBalancerFactory {
105 public LoadBalancer createLoadBalancer(String lbType) {
106 return switch (lbType) {
107 case "round-robin" -> new RoundRobinLoadBalancer();
108 case "least-connection" -> new LeastConnectionLoadBalancer();
109 default -> new LeastConnectionLoadBalancer();
110 };
111 }
112}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected