public Stream<Message> stream() { Spliterator<Message> sp=Spliterators.spliterator(iterator(), size(), 0); return StreamSupport.stream(sp, false); }
public void up(MessageBatch batch) { for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg != null && shouldDropUpMessage(msg, msg.getSrc())) it.remove(); } if(!batch.isEmpty()) up_prot.up(batch); }
/** * Sends up a multiple messages in a {@link MessageBatch}. The sender of the batch is always the same, and so is the * destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed * messages, although the transport itself will create initial MessageBatches that contain only either OOB or * regular messages.<p/> * The default processing below sends messages up the stack individually, based on a matching criteria * (calling {@link #accept(org.jgroups.Message)}), and - if true - calls {@link #up(org.jgroups.Event)} * for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.<p/> * Subclasses should check if there are any messages destined for them (e.g. using * {@link MessageBatch#getMatchingMessages(short,boolean)}), then possibly remove and process them and finally pass * the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all * encrypted messages in the batch, not remove them, and pass the batch up when done. * @param batch The message batch */ public void up(MessageBatch batch) { for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg != null && accept(msg)) { it.remove(); try { up(msg); } catch(Throwable t) { log.error(Util.getMessage("PassUpFailure"), t); } } } if(!batch.isEmpty()) up_prot.up(batch); }
/** * Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737 */ protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg.isFlagSet(Message.Flag.DONT_BUNDLE) && msg.isFlagSet(Message.Flag.OOB)) { boolean internal=msg.isFlagSet(Message.Flag.INTERNAL); it.remove(); if(tp.statsEnabled()) tp.getMessageStats().incrNumOOBMsgsReceived(1); tp.submitToThreadPool(new SingleMessageHandlerWithClusterName(msg, cname), internal); } } }
ReceiverEntry entry=recv_table.get(batch.sender()); for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); UnicastHeader3 hdr;
protected void handleBatchFromSelf(MessageBatch batch, Entry entry) { List<LongTuple<Message>> list=new ArrayList<>(batch.size()); for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); UnicastHeader3 hdr;
for(Iterator<Message> it=batch.iterator(); it.hasNext();) { final Message msg=it.next(); NakAckHeader2 hdr;
public Stream<Message> stream() { Spliterator<Message> sp=Spliterators.spliterator(iterator(), size(), 0); return StreamSupport.stream(sp, false); }
public void up(MessageBatch batch) { for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg != null && shouldDropUpMessage(msg, msg.getSrc())) it.remove(); } if(!batch.isEmpty()) up_prot.up(batch); }
/** * Sends up a multiple messages in a {@link MessageBatch}. The sender of the batch is always the same, and so is the * destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed * messages, although the transport itself will create initial MessageBatches that contain only either OOB or * regular messages.<p/> * The default processing below sends messages up the stack individually, based on a matching criteria * (calling {@link #accept(org.jgroups.Message)}), and - if true - calls {@link #up(org.jgroups.Event)} * for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.<p/> * Subclasses should check if there are any messages destined for them (e.g. using * {@link MessageBatch#getMatchingMessages(short,boolean)}), then possibly remove and process them and finally pass * the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all * encrypted messages in the batch, not remove them, and pass the batch up when done. * @param batch The message batch */ public void up(MessageBatch batch) { for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg != null && accept(msg)) { it.remove(); try { up(msg); } catch(Throwable t) { log.error(Util.getMessage("PassUpFailure"), t); } } } if(!batch.isEmpty()) up_prot.up(batch); }
/** * Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737 */ protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg.isFlagSet(Message.Flag.DONT_BUNDLE) && msg.isFlagSet(Message.Flag.OOB)) { boolean internal=msg.isFlagSet(Message.Flag.INTERNAL); it.remove(); if(tp.statsEnabled()) tp.getMessageStats().incrNumOOBMsgsReceived(1); tp.submitToThreadPool(new SingleMessageHandlerWithClusterName(msg, cname), internal); } } }
ReceiverEntry entry=recv_table.get(batch.sender()); for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); UnicastHeader3 hdr;
protected void handleBatchFromSelf(MessageBatch batch, Entry entry) { List<LongTuple<Message>> list=new ArrayList<>(batch.size()); for(Iterator<Message> it=batch.iterator(); it.hasNext();) { Message msg=it.next(); UnicastHeader3 hdr;
for(Iterator<Message> it=batch.iterator(); it.hasNext();) { final Message msg=it.next(); NakAckHeader2 hdr;