Package org.jgroups
Class RefcountedNioMessage
- java.lang.Object
-
- org.jgroups.BaseMessage
-
- org.jgroups.NioMessage
-
- org.jgroups.RefcountedNioMessage
-
- All Implemented Interfaces:
Constructable<Message>,Message,Refcountable<Message>,SizeStreamable,Streamable
public class RefcountedNioMessage extends NioMessage 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.NioMessage
buf, use_direct_memory_for_allocations
-
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 RefcountedNioMessage()RefcountedNioMessage(Address dest)RefcountedNioMessage(Address dest, java.nio.ByteBuffer buf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RefcountedNioMessagedecr()Decrements the refcount.bytegetRefcount()RefcountedNioMessageincr()Increments the refcountRefcountedNioMessageonRelease(java.util.function.Consumer<Message> rc)java.lang.StringtoString()-
Methods inherited from class org.jgroups.NioMessage
copy, copyPayload, create, createBuffer, getArray, getBuf, getLength, getObject, getObject, getOffset, getType, hasArray, hasPayload, isDirect, readPayload, setArray, setArray, setBuf, setObject, size, sizeOfPayload, useDirectMemory, useDirectMemory, writePayload
-
Methods inherited from class org.jgroups.BaseMessage
clearFlag, clearFlag, createHeaders, getDest, getFlags, getHeader, getHeaders, getNumHeaders, getPayload, getSrc, isFlagSet, isFlagSet, printHeaders, putHeader, readFrom, readHeader, serializedSize, setDest, setFlag, setFlag, setFlag, setFlagIfAbsent, setPayload, setSrc, writeHeader, writeHeaders, writeTo, writeToNoAddrs
-
-
-
-
Field Detail
-
impl
protected final RefcountImpl<Message> impl
-
-
Method Detail
-
getRefcount
public byte getRefcount()
-
incr
public RefcountedNioMessage incr()
Description copied from interface:RefcountableIncrements the refcount- Specified by:
incrin interfaceRefcountable<Message>- Returns:
- T the type (typically a message)
-
decr
public RefcountedNioMessage 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 RefcountedNioMessage onRelease(java.util.function.Consumer<Message> rc)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classNioMessage
-
-