All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.protocols.UNBATCH Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 34.0.0.Final
Show newest version
package org.jgroups.protocols;

import org.jgroups.Message;
import org.jgroups.annotations.MBean;
import org.jgroups.annotations.Property;
import org.jgroups.stack.Protocol;
import org.jgroups.util.MessageBatch;

/**
 * Intercepts {@link org.jgroups.stack.Protocol#up(MessageBatch)} and passes up each message of a message batch
 * as a single message. Mainly to be used in unit tests (https://issues.redhat.com/browse/JGRP-2702).
 * @author Bela Ban
 * @since  5.2.18
 */
@MBean(description="Passes each message from a MessageBatch up as a single message")
public class UNBATCH extends Protocol {
    @Property(description="If enabled, message batches are passed up as single messages, otherwise as batches")
    protected boolean enabled=true;

    public boolean enabled()         {return enabled;}
    public UNBATCH enable(boolean b) {enabled=b; return this;}

    @Override
    public void up(MessageBatch batch) {
        if(!enabled) {
            up_prot.up(batch);
            return;
        }
        for(Message msg: batch)
            up_prot.up(msg);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy