@Override public void execute() throws ResourceAllocationException, ResourceUnavailableException { HealthCheckPolicy policy = null; boolean success = false; try { CallContext.current().setEventDetails("Load balancer health check policy ID : " + getEntityId()); success = _lbService.applyLBHealthCheckPolicy(this); if (success) { // State might be different after the rule is applied, so get new object here policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId()); LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId()); LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb); setResponseObject(hcResponse); hcResponse.setResponseName(getCommandName()); } } finally { if (!success || (policy == null)) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create health check policy"); } } }
@Override public void execute() throws ResourceAllocationException, ResourceUnavailableException { HealthCheckPolicy policy = null; boolean success = false; try { CallContext.current().setEventDetails("Load balancer health check policy ID : " + getEntityId()); success = _lbService.applyLBHealthCheckPolicy(this); if (success) { // State might be different after the rule is applied, so get new object here policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId()); final LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId()); final LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb); setResponseObject(hcResponse); hcResponse.setResponseName(getCommandName()); } } finally { if (!success || (policy == null)) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create health check policy"); } } }