/** * Handles a message coming from a layer below * @return true if the message was consumed, don't pass it further up, else false */ public boolean receiveMessage(Message msg) { Header hdr=msg.getHeader(this.corr_id); // Check if the message was sent by a request correlator with the same name; // there may be multiple request correlators in the same protocol stack if(hdr == null || hdr.corrId != this.corr_id) { log.trace("ID of request correlator header (%s) is different from ours (%d). Msg not accepted, passed up", hdr != null? String.valueOf(hdr.corrId) : "null", this.corr_id); return false; } if(hdr instanceof MultiDestinationHeader) { // if we are part of the exclusion list, then we discard the request (addressed to different members) Address[] exclusion_list=((MultiDestinationHeader)hdr).exclusion_list; if(exclusion_list != null && local_addr != null && Util.contains(local_addr, exclusion_list)) { log.trace("%s: dropped req from %s as we are in the exclusion list, hdr=%s", local_addr, msg.src(), hdr); return true; // don't pass this message further up } } dispatch(msg, hdr); return true; // message was consumed }
public void receiveMessageBatch(MessageBatch batch) { for(Message msg : batch) { Header hdr=msg.getHeader(this.corr_id); if(hdr == null || hdr.corrId != this.corr_id) // msg was sent by a different request corr in the same stack continue; if(hdr instanceof MultiDestinationHeader) { // if we are part of the exclusion list, then we discard the request (addressed to different members) Address[] exclusion_list=((MultiDestinationHeader)hdr).exclusion_list; if(exclusion_list != null && local_addr != null && Util.contains(local_addr, exclusion_list)) { log.trace("%s: dropped req from %s as we are in the exclusion list, hdr=%s", local_addr, msg.src(), hdr); batch.remove(msg); continue; // don't pass this message further up } } dispatch(msg, hdr); } }
/** * Handles a message coming from a layer below * @return true if the message was consumed, don't pass it further up, else false */ public boolean receiveMessage(Message msg) { Header hdr=msg.getHeader(this.corr_id); // Check if the message was sent by a request correlator with the same name; // there may be multiple request correlators in the same protocol stack if(hdr == null || hdr.corrId != this.corr_id) { log.trace("ID of request correlator header (%s) is different from ours (%d). Msg not accepted, passed up", hdr != null? String.valueOf(hdr.corrId) : "null", this.corr_id); return false; } if(hdr instanceof MultiDestinationHeader) { // if we are part of the exclusion list, then we discard the request (addressed to different members) Address[] exclusion_list=((MultiDestinationHeader)hdr).exclusion_list; if(exclusion_list != null && local_addr != null && Util.contains(local_addr, exclusion_list)) { log.trace("%s: dropped req from %s as we are in the exclusion list, hdr=%s", local_addr, msg.src(), hdr); return true; // don't pass this message further up } } dispatch(msg, hdr); return true; // message was consumed }
public void receiveMessageBatch(MessageBatch batch) { for(Message msg : batch) { Header hdr=msg.getHeader(this.corr_id); if(hdr == null || hdr.corrId != this.corr_id) // msg was sent by a different request corr in the same stack continue; if(hdr instanceof MultiDestinationHeader) { // if we are part of the exclusion list, then we discard the request (addressed to different members) Address[] exclusion_list=((MultiDestinationHeader)hdr).exclusion_list; if(exclusion_list != null && local_addr != null && Util.contains(local_addr, exclusion_list)) { log.trace("%s: dropped req from %s as we are in the exclusion list, hdr=%s", local_addr, msg.src(), hdr); batch.remove(msg); continue; // don't pass this message further up } } dispatch(msg, hdr); } }