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

org.jgroups.util.UnbatchOOBBatches Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and Jakarta Messaging 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).

The newest version!
package org.jgroups.util;

import org.jgroups.Message;

/**
 * Same as {@link MaxOneThreadPerSender}, but for OOB message batches, every message of the batch is passed to the
 * thread pool separately (https://issues.redhat.com/browse/JGRP-2800).
 * @author Bela Ban
 * @since  5.4, 5.3.7
 */
public class UnbatchOOBBatches extends MaxOneThreadPerSender {

    @Override
    public boolean process(MessageBatch batch, boolean oob) {
        if(!oob)
            return super.process(batch, oob);
        AsciiString tmp=batch.clusterName();
        byte[] cname=tmp != null? tmp.chars() : null;
        for(Message msg: batch)
            tp.getThreadPool().execute(new SingleMessageHandlerWithClusterName(msg, cname));
        batch.clear();
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy