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

org.jgroups.EmptyMessage 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;

import org.jgroups.util.ByteArray;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.function.Supplier;

/**
 * A {@link Message} without a payload; optimized for sending only headers (e.g. heartbeats in failure detection)
 * @author Bela Ban
 * @since  5.0
 */
public class EmptyMessage extends BaseMessage {

    public EmptyMessage() {
    }

    public EmptyMessage(Address dest) {
        super(dest);
    }

    public short                 getType()                            {return Message.EMPTY_MSG;}
    public Supplier     create()                             {return EmptyMessage::new;}
    public boolean               hasPayload()                         {return false;}
    public boolean               hasArray()                           {return false;}
    public byte[]                getArray()                           {return null;}
    public int                   getOffset()                          {return 0;}
    public int                   getLength()                          {return 0;}
    public EmptyMessage          setArray(byte[] b, int off, int len) {return this;}
    public EmptyMessage          setArray(ByteArray buf)              {return this;}
    public  T  getObject()                          {return null;}
    public EmptyMessage          setObject(Object obj)                {return this;}

    public void                  writePayload(DataOutput out) throws IOException {
        // no payload to write
    }

    public void                  readPayload(DataInput in) throws IOException, ClassNotFoundException {
        // no payload to read
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy