Class GridCacheReturn
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheReturn
-
- All Implemented Interfaces:
Externalizable,Serializable,Message
public class GridCacheReturn extends Object implements Externalizable, Message
Return value for cases where both, value and success flag need to be returned.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message
DIRECT_TYPE_SIZE
-
-
Constructor Summary
Constructors Constructor Description GridCacheReturn()Empty constructor.GridCacheReturn(boolean loc)GridCacheReturn(boolean loc, boolean success)GridCacheReturn(GridCacheContext cctx, boolean loc, boolean keepBinary, @Nullable ClassLoader ldr, Object v, boolean success)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEntryProcessResult(GridCacheContext cctx, KeyCacheObject key, @Nullable Object key0, @Nullable Object res, @Nullable Exception err, boolean keepBinary)intcacheId()shortdirectType()Gets message type.booleanemptyResult()bytefieldsCount()Gets fields count.voidfinishUnmarshal(GridCacheContext ctx, ClassLoader ldr)booleaninvokeResult()voidinvokeResult(boolean invokeRes)voidmarshalResult(GridCacheContext ctx)Converts entry processor invokation results to cache object instances.voidmergeEntryProcessResults(GridCacheReturn other)voidonAckReceived()Method called when ack message received.voidprepareMarshal(GridCacheContext ctx)voidreadExternal(ObjectInput in)booleanreadFrom(ByteBuffer buf, MessageReader reader)Reads this message from provided byte buffer.GridCacheReturnset(GridCacheContext cctx, @Nullable CacheObject cacheObj, boolean success, boolean keepBinary, @Nullable ClassLoader ldr)booleansuccess()GridCacheReturnsuccess(boolean success)StringtoString()<V> Vvalue()GridCacheReturnvalue(GridCacheContext cctx, CacheObject v, boolean keepBinary, @Nullable ClassLoader ldr)voidwriteExternal(ObjectOutput out)booleanwriteTo(ByteBuffer buf, MessageWriter writer)Writes this message to provided byte buffer.
-
-
-
Constructor Detail
-
GridCacheReturn
public GridCacheReturn()
Empty constructor.
-
GridCacheReturn
public GridCacheReturn(boolean loc)
- Parameters:
loc-Trueif created on the node initiated cache operation.
-
GridCacheReturn
public GridCacheReturn(boolean loc, boolean success)- Parameters:
loc-Trueif created on the node initiated cache operation.success- Success flag.
-
GridCacheReturn
public GridCacheReturn(GridCacheContext cctx, boolean loc, boolean keepBinary, @Nullable @Nullable ClassLoader ldr, Object v, boolean success)
- Parameters:
cctx- Cache context.loc-Trueif created on the node initiated cache operation.keepBinary- True is deserialize value from a binary representation, false otherwise.ldr- Class loader, used for deserialization from binary representation.v- Value.success- Success flag.
-
-
Method Detail
-
value
@Nullable public <V> V value()
- Returns:
- Value.
-
emptyResult
public boolean emptyResult()
-
invokeResult
public boolean invokeResult()
- Returns:
- If return is invoke result.
-
invokeResult
public void invokeResult(boolean invokeRes)
- Parameters:
invokeRes- Invoke result flag.
-
value
public GridCacheReturn value(GridCacheContext cctx, CacheObject v, boolean keepBinary, @Nullable @Nullable ClassLoader ldr)
- Parameters:
cctx- Cache context.v- Value.keepBinary- Keep binary flag.ldr- Class loader, used for deserialization from binary representation.- Returns:
- This instance for chaining.
-
success
public boolean success()
- Returns:
- Success flag.
-
set
public GridCacheReturn set(GridCacheContext cctx, @Nullable @Nullable CacheObject cacheObj, boolean success, boolean keepBinary, @Nullable @Nullable ClassLoader ldr)
- Parameters:
cctx- Cache context.cacheObj- Value to set.success- Success flag to set.keepBinary- Keep binary flag.ldr- Class loader, used for deserialization from binary representation.- Returns:
- This instance for chaining.
-
success
public GridCacheReturn success(boolean success)
- Parameters:
success- Success flag.- Returns:
- This instance for chaining.
-
addEntryProcessResult
public void addEntryProcessResult(GridCacheContext cctx, KeyCacheObject key, @Nullable @Nullable Object key0, @Nullable @Nullable Object res, @Nullable @Nullable Exception err, boolean keepBinary)
- Parameters:
cctx- Context.key- Key.key0- Key value.res- Result.err- Error.keepBinary- Keep binary.
-
cacheId
public int cacheId()
- Returns:
- Cache ID.
-
mergeEntryProcessResults
public void mergeEntryProcessResults(GridCacheReturn other)
- Parameters:
other- Other result to merge with.
-
marshalResult
public void marshalResult(GridCacheContext ctx)
Converts entry processor invokation results to cache object instances.- Parameters:
ctx- Cache context.
-
prepareMarshal
public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException
- Parameters:
ctx- Cache context.- Throws:
IgniteCheckedException- If failed.
-
finishUnmarshal
public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException
- Parameters:
ctx- Cache context.ldr- Class loader.- Throws:
IgniteCheckedException- If failed.
-
onAckReceived
public void onAckReceived()
Method called when ack message received.- Specified by:
onAckReceivedin interfaceMessage
-
directType
public short directType()
Gets message type.- Specified by:
directTypein interfaceMessage- Returns:
- Message type.
-
writeTo
public boolean writeTo(ByteBuffer buf, MessageWriter writer)
Writes this message to provided byte buffer.
-
readFrom
public boolean readFrom(ByteBuffer buf, MessageReader reader)
Reads this message from provided byte buffer.
-
fieldsCount
public byte fieldsCount()
Gets fields count.- Specified by:
fieldsCountin interfaceMessage- Returns:
- Fields count.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-