public Object down(Message msg) { if(msg.getDest() != null || msg.isFlagSet(Message.Flag.NO_TOTAL_ORDER) || msg.isFlagSet(Message.Flag.OOB)) return down_prot.down(msg); if(msg.getSrc() == null) msg.setSrc(local_addr); if(flushing) block(); // A seqno is not used to establish ordering, but only to weed out duplicates; next_seqno doesn't need // to increase monotonically, but only to be unique (https://issues.jboss.org/browse/JGRP-1461) ! long next_seqno=seqno.incrementAndGet(); in_flight_sends.incrementAndGet(); try { SequencerHeader hdr=new SequencerHeader(is_coord? SequencerHeader.BCAST : SequencerHeader.WRAPPED_BCAST, next_seqno); msg.putHeader(this.id, hdr); if(log.isTraceEnabled()) log.trace("[" + local_addr + "]: forwarding " + local_addr + "::" + seqno + " to coord " + coord); // We always forward messages to the coordinator, even if we're the coordinator. Having the coord // send its messages directly led to starvation of messages from other members. MPerf perf went up // from 20MB/sec/node to 50MB/sec/node with this change ! forwardToCoord(next_seqno, msg); } catch(Exception ex) { log.error(Util.getMessage("FailedSendingMessage"), ex); } finally { in_flight_sends.decrementAndGet(); } return null; // don't pass down }
public Object down(Message msg) { if(msg.getDest() != null || msg.isFlagSet(Message.Flag.NO_TOTAL_ORDER) || msg.isFlagSet(Message.Flag.OOB)) return down_prot.down(msg); if(msg.getSrc() == null) msg.setSrc(local_addr); if(flushing) block(); // A seqno is not used to establish ordering, but only to weed out duplicates; next_seqno doesn't need // to increase monotonically, but only to be unique (https://issues.jboss.org/browse/JGRP-1461) ! long next_seqno=seqno.incrementAndGet(); in_flight_sends.incrementAndGet(); try { SequencerHeader hdr=new SequencerHeader(is_coord? SequencerHeader.BCAST : SequencerHeader.WRAPPED_BCAST, next_seqno); msg.putHeader(this.id, hdr); if(log.isTraceEnabled()) log.trace("[" + local_addr + "]: forwarding " + local_addr + "::" + seqno + " to coord " + coord); // We always forward messages to the coordinator, even if we're the coordinator. Having the coord // send its messages directly led to starvation of messages from other members. MPerf perf went up // from 20MB/sec/node to 50MB/sec/node with this change ! forwardToCoord(next_seqno, msg); } catch(Exception ex) { log.error(Util.getMessage("FailedSendingMessage"), ex); } finally { in_flight_sends.decrementAndGet(); } return null; // don't pass down }
public Object down(Event evt) { switch(evt.getType()) { case Event.MSG: Message msg=(Message)evt.getArg(); Address dest=msg.getDest(); if(dest == null || dest.isMulticastAddress()) { // only handle multicasts long next_seqno=nextSeqno(); SequencerHeader hdr=new SequencerHeader(SequencerHeader.FORWARD, local_addr, next_seqno); msg.putHeader(name, hdr); if(!is_coord) { forwardToCoord(msg, next_seqno); } else { broadcast(msg); } return null; // don't pass down } break; case Event.VIEW_CHANGE: handleViewChange((View)evt.getArg()); break; } return down_prot.down(evt); }