}
public boolean invoke(Request request, Response response)
throws Exception {
HttpRequest httpReq = (HttpRequest) request;
String requestUri = httpReq.requestURI().toString();
if(_logger.isLoggable(Level.FINER))
_logger.log(Level.FINER,
"clb.httpLBM_servicing_request",
new Object[]{requestUri});
if (ProxyKeyExtractor.isHttpRequestProxied(httpReq)) {
if(_logger.isLoggable(Level.FINER))
_logger.log(Level.FINER,
"clb.httpLBM_request_already_proxied",
new Object[]{requestUri});
setLocalEndPoint(httpReq);
if(clbMonitoringManager.isCLBMonitoringEnabled()){
clbMonitoringManager.getCLBStatsUpdater().
incrementTotalIncomingHttpRequestsBE();
}
return true;
}
if(clbMonitoringManager.isCLBMonitoringEnabled()){
clbMonitoringManager.getCLBStatsUpdater().
incrementTotalIncomingHttpRequestsFE();
}
/* Case Controller is null
* The possibility is that initialization is not done - This may happen in case
* if converged-load-balancer.xml is corrupt or not present at all
*/
if (controller == null) {
/* Only case it can be null is when it is not intialized for load-balancing
* Cannot handle this request so setting error in response
*/
_logger.log(Level.SEVERE,
"clb.controller_null_returning_error",
new Object[]{requestUri});
setErrorInResponse(response);
return false;
}
RequestGroup reqGroup = controller.getRequestGroup(requestUri);
if (reqGroup == null) {
/* No request group found for this request
* let pass it to the same instance and see if it can handle it
*/
if(_logger.isLoggable(Level.FINER))
_logger.log(Level.FINER,
"clb.locally_service_request",
new Object[]{requestUri});
setLocalEndPoint(httpReq);
if(clbMonitoringManager.isCLBMonitoringEnabled()){
clbMonitoringManager.getCLBStatsUpdater().
incrementTotalLocalHttpRequestsFE();
clbMonitoringManager.getCLBStatsUpdater().
incrementTotalIncomingHttpRequestsBE();
}
return true;
}
if(_logger.isLoggable(Level.FINER))
_logger.log(Level.FINER,
"clb.request_group_found",
new Object[]{requestUri});
reqGroup.serviceRequest(httpReq, (Response) response);
if(httpReq.getConvergedLoadBalancerEndpoint() == null){
_logger.log(Level.SEVERE,
"clb.no_endpoint_set_to_service_request",
new Object[]{requestUri});
setErrorInResponse(response);
return false;
}
if (httpReq.getConvergedLoadBalancerEndpoint().isLocal()) {
if(_logger.isLoggable(Level.FINER))
_logger.log(Level.FINER,
"clb.request_to_be_serviced_by_local_endpoint",
new Object[]{requestUri});
if(clbMonitoringManager.isCLBMonitoringEnabled()){