/** * If this endpoint is in inactive state, checks if all immediate child endpoints are still * failed. If so returns false. If at least one child endpoint is in active state, sets this * endpoint's state to active and returns true. As this a sessionless load balancing endpoint * having one active child endpoint is enough to consider this as active. * * @return true if active. false otherwise. */ public boolean readyToSend() { for (Endpoint endpoint : getChildren()) { if (endpoint.readyToSend()) { if (log.isDebugEnabled()) { log.debug("Load-balance " + this.toString() + " has at least one endpoint at ready state"); } return true; } } log.warn("Load-balance " + this.toString() + " has no endpoints at ready state to process message"); return false; }
/** * If this endpoint is in inactive state, checks if all immediate child endpoints are still * failed. If so returns false. If at least one child endpoint is in active state, sets this * endpoint's state to active and returns true. As this a sessionless load balancing endpoint * having one active child endpoint is enough to consider this as active. * * @return true if active. false otherwise. */ public boolean readyToSend() { if (getContext().isState(EndpointContext.ST_OFF)) { return false; } for (Endpoint endpoint : getChildren()) { if (endpoint.readyToSend()) { if (log.isDebugEnabled()) { log.debug("Load-balance " + this.toString() + " has at least one endpoint at ready state"); } return true; } } log.warn("Load-balance " + this.toString() + " has no endpoints at ready state to process message"); return false; }
if (loadbalanceEndpoint.getChildren() != null) { for (Endpoint childEndpoint : loadbalanceEndpoint.getChildren()) { loadbalanceElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
if (loadbalanceEndpoint.getChildren() != null) { for (Endpoint childEndpoint : loadbalanceEndpoint.getChildren()) { loadbalanceElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
if (loadbalanceEndpoint.getChildren() == null && loadbalanceEndpoint.getMembers() == null) { String msg = "Invalid Synapse configuration.\n"
if (loadbalanceEndpoint.getChildren() == null && loadbalanceEndpoint.getMembers() == null) { String msg = "Invalid Synapse configuration.\n"
List children = loadbalanceEndpoint.getChildren(); assertEquals("Top level endpoint should have 2 child endpoints.", children.size(), 2);
List children = loadbalanceEndpoint.getChildren(); assertEquals("Top level endpoint should have 2 child endpoints.", children.size(), 2);
List addresses = endpoint.getChildren(); assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);
List addresses = endpoint.getChildren(); assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);