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

org.jgroups.protocols.Fragmentation 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.annotations.MBean;
import org.jgroups.annotations.ManagedAttribute;
import org.jgroups.annotations.Property;
import org.jgroups.conf.AttributeType;
import org.jgroups.stack.Protocol;

import java.util.concurrent.atomic.LongAdder;

/**
 * Base class for all fragmentation protocols.
 * @author Bela Ban
 * @since  5.0.0
 */
@MBean(description="Fragments messages larger than fragmentation size into smaller messages")
public class Fragmentation extends Protocol {

    @Property(description="The max number of bytes in a message. Larger messages will be fragmented",
      type=AttributeType.BYTES)
    protected int                 frag_size=60000;

    protected LongAdder num_frags_sent=new LongAdder();
    protected LongAdder num_frags_received=new LongAdder();


    public int                         getFragSize()      {return frag_size;}
    public  T setFragSize(int f) {this.frag_size=f; return (T)this;}

    @ManagedAttribute(description="Number of sent fragments",type=AttributeType.SCALAR)
    public long                        getNumberOfSentFragments()     {return num_frags_sent.sum();}

    @ManagedAttribute(description="Number of received fragments",type=AttributeType.SCALAR)
    public long                        getNumberOfReceivedFragments() {return num_frags_received.sum();}

    public void resetStats() {
        super.resetStats();
        num_frags_sent.reset();
        num_frags_received.reset();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy