| 83 | } |
| 84 | |
| 85 | class Destination { |
| 86 | String ipAddress; |
| 87 | int requestsBeingServed; |
| 88 | int threshold; |
| 89 | |
| 90 | public boolean acceptRequest(Request request) { |
| 91 | if (threshold <= requestsBeingServed) { |
| 92 | requestsBeingServed++; |
| 93 | return true; |
| 94 | } else { |
| 95 | return false; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | private void completeRequest(){ |
| 100 | requestsBeingServed--; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | class LoadBalancerFactory { |
| 105 | public LoadBalancer createLoadBalancer(String lbType) { |
nothing calls this directly
no outgoing calls
no test coverage detected