Package org.jgroups
Class RefcountedBytesMessage
- java.lang.Object
-
- org.jgroups.BaseMessage
-
- org.jgroups.BytesMessage
-
- org.jgroups.RefcountedBytesMessage
-
- All Implemented Interfaces:
Constructable<Message>,Message,Refcountable<Message>,SizeStreamable,Streamable
public class RefcountedBytesMessage extends BytesMessage implements Refcountable<Message>
Ref-counted message implementation.
Note that this class is experimental and may get removed without notice. The point of it is to get experience with ref counted messages and see if they're needed or not.
See https://issues.redhat.com/browse/JGRP-2417 for details- Since:
- 5.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jgroups.Message
Message.Flag, Message.TransientFlag
-
-
Field Summary
Fields Modifier and Type Field Description protected RefcountImpl<Message>impl-
Fields inherited from class org.jgroups.BytesMessage
array, length, offset
-
Fields inherited from class org.jgroups.BaseMessage
dest, DEST_SET, flags, headers, sender, SRC_SET, transient_flags
-
Fields inherited from interface org.jgroups.Message
BYTES_MSG, COMPOSITE_MSG, EARLYBATCH_MSG, EMPTY_MSG, FRAG_MSG, LONG_MSG, NIO_MSG, OBJ_MSG
-
-
Constructor Summary
Constructors Constructor Description RefcountedBytesMessage()RefcountedBytesMessage(Address dest)RefcountedBytesMessage(Address dest, byte[] array)RefcountedBytesMessage(Address dest, byte[] array, int offset, int length)RefcountedBytesMessage(Address dest, java.lang.Object obj)RefcountedBytesMessage(Address dest, ByteArray array)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RefcountedBytesMessagedecr()Decrements the refcount.bytegetRefcount()RefcountedBytesMessageincr()Increments the refcountRefcountedBytesMessageonRelease(java.util.function.Consumer<Message> rc)java.lang.StringtoString()-
Methods inherited from class org.jgroups.BytesMessage
copyPayload, create, createMessage, getArray, getLength, getObject, getObject, getOffset, getType, hasArray, hasPayload, readPayload, setArray, setArray, setFlag, setObject, size, sizeOfPayload, writePayload
-
Methods inherited from class org.jgroups.BaseMessage
clearFlag, clearFlag, copy, createHeaders, getDest, getFlags, getHeader, getHeaders, getNumHeaders, getPayload, getSrc, isFlagSet, isFlagSet, printHeaders, putHeader, readFrom, readHeader, serializedSize, setDest, setFlag, setFlag, setFlagIfAbsent, setPayload, setSrc, writeHeader, writeHeaders, writeTo, writeToNoAddrs
-
-
-
-
Field Detail
-
impl
protected final RefcountImpl<Message> impl
-
-
Constructor Detail
-
RefcountedBytesMessage
public RefcountedBytesMessage()
-
RefcountedBytesMessage
public RefcountedBytesMessage(Address dest)
-
RefcountedBytesMessage
public RefcountedBytesMessage(Address dest, byte[] array)
-
RefcountedBytesMessage
public RefcountedBytesMessage(Address dest, byte[] array, int offset, int length)
-
RefcountedBytesMessage
public RefcountedBytesMessage(Address dest, java.lang.Object obj)
-
-
Method Detail
-
getRefcount
public byte getRefcount()
-
incr
public RefcountedBytesMessage incr()
Description copied from interface:RefcountableIncrements the refcount- Specified by:
incrin interfaceRefcountable<Message>- Returns:
- T the type (typically a message)
-
decr
public RefcountedBytesMessage decr()
Description copied from interface:RefcountableDecrements the refcount. This should not become negative. When the refount is 0 for the first time, the shared resource can be returned (in order to be reused).- Specified by:
decrin interfaceRefcountable<Message>- Returns:
- T the type (typically a message)
-
onRelease
public RefcountedBytesMessage onRelease(java.util.function.Consumer<Message> rc)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseMessage
-
-