Class CacheObjectBinaryProcessorImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl
-
- All Implemented Interfaces:
GridComponent,IgniteCacheObjectProcessor,GridProcessor
public class CacheObjectBinaryProcessorImpl extends GridProcessorAdapter implements IgniteCacheObjectProcessor
Binary processor implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCacheObjectBinaryProcessorImpl.TestBinaryContext-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
Fields Modifier and Type Field Description static StringBINARY_METADATA_DESCstatic StringBINARY_METADATA_VIEWstatic intDFLT_WAIT_SCHEMA_UPDATEstatic booleanuseTestBinaryCtxFor tests.-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description CacheObjectBinaryProcessorImpl(GridKernalContext ctx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinaryMetadataUpdateListener(BinaryMetadataUpdatedListener lsnr)Add binary metadata update listener.voidaddMeta(int typeId, BinaryType newMeta, boolean failIfUnregistered)voidaddMetaLocally(int typeId, BinaryType newMeta)Adds metadata locally without triggering discovery exchange.BinaryFieldaffinityKeyField(int typeId)Get affinity key field.IgniteBinarybinary()BinaryContextbinaryContext()Collection<BinaryMetadata>binaryMetadata()BinaryMetadatabinaryMetadata(int typeId)static FilebinaryWorkDir(String igniteWorkDir, String consId)BinaryObjectbuildEnum(String typeName, int ord)BinaryObjectbuildEnum(String typeName, String name)BinaryObjectBuilderbuilder(String clsName)BinaryObjectBuilderbuilder(BinaryObject binaryObj)Creates builder initialized by existing binary object.voidcacheMetadataLocally(File metadataDir, int typeId)Merge the binary metadata file stored in the specified directory.voidcollectGridNodeData(DiscoveryDataBag dataBag)Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.voidcollectJoiningNodeData(DiscoveryDataBag dataBag)Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.CacheObjectContextcontextForCache(CacheConfiguration ccfg)@Nullable GridComponent.DiscoveryDataExchangeTypediscoveryDataType()Gets unique component type to distinguish components providing discovery data.Objectfield(Object obj, String fieldName)booleanhasField(Object obj, String fieldName)Checks whether field is set in the object.booleanimmutable(Object obj)booleanisBinaryEnabled(CacheConfiguration<?,?> ccfg)Checks whether given class is binary.booleanisBinaryObject(Object obj)Checks whether object is binary object.byte[]marshal(@Nullable Object obj)byte[]marshal(CacheObjectValueContext ctx, Object val)GridBinaryMarshallermarshaller()ObjectmarshalToBinary(@Nullable Object obj, boolean failIfUnregistered)Collection<BinaryType>metadata()@Nullable BinaryTypemetadata(int typeId)@Nullable BinaryTypemetadata(int typeId, int schemaId)Map<Integer,BinaryType>metadata(Collection<Integer> typeIds)@Nullable BinaryMetadatametadata0(int typeId)voidonContinuousProcessorStarted(GridKernalContext ctx)voidonDisconnected(IgniteFuture<?> reconnectFut)Client disconnected callback.voidonGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)Receives discovery data object from remote nodes (called on new node during discovery process).voidonJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)Method is called on nodes that are already in grid (not on joining node).voidonKernalStart(boolean active)Callback that notifies that kernal has successfully started, including all managers and processors.IgniteInternalFuture<?>onReconnected(boolean clusterRestarted)Client reconnected callback.@Nullable CacheObjectprepareForCache(@Nullable CacheObject obj, GridCacheContext cctx)Prepares cache object for cache (e.g. copies user-provided object if needed).BinaryTyperegisterClass(Class<?> cls)Register binary type for specified class.BinaryTyperegisterEnum(String typeName, Map<String,Integer> vals)Register enum typevoidremoveType(int typeId)Remove registered binary type from grid.static FileresolveBinaryWorkDir(String igniteWorkDir, String consId)voidsaveMetadata(Collection<BinaryType> types, File dir)voidsetBinaryMetadataFileStoreDir(@Nullable File binaryMetadataFileStoreDir)Sets path to binary metadata store configured by user, should include binary_meta and consistentIdvoidstart()Starts grid component.voidstop(boolean cancel)Stops grid component.@Nullable ObjecttoBinary(@Nullable Object obj, boolean failIfUnregistered)KeyCacheObjecttoCacheKeyObject(CacheObjectContext ctx, @Nullable GridCacheContext cctx, Object obj, boolean userObj)protected KeyCacheObjecttoCacheKeyObject0(CacheObjectContext ctx, @Nullable GridCacheContext cctx, Object obj, boolean userObj)CacheObjecttoCacheObject(CacheObjectContext ctx, byte type, byte[] bytes)@Nullable CacheObjecttoCacheObject(CacheObjectContext ctx, @Nullable Object obj, boolean userObj)@Nullable CacheObjecttoCacheObject(CacheObjectContext ctx, @Nullable Object obj, boolean userObj, boolean failIfUnregistered)CacheObjecttoCacheObject(CacheObjectContext ctx, ByteBuffer buf)IncompleteCacheObjecttoCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable IncompleteCacheObject incompleteObj)KeyCacheObjecttoKeyCacheObject(CacheObjectContext ctx, byte type, byte[] bytes)IncompleteCacheObjecttoKeyCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable IncompleteCacheObject incompleteObj)inttypeId(Object obj)inttypeId(String typeName)Objectunmarshal(long ptr, boolean forceHeap)Objectunmarshal(CacheObjectValueContext ctx, byte[] bytes, ClassLoader clsLdr)ObjectunwrapTemporary(GridCacheContext ctx, Object obj)Converts temporary off-heap object to heap-based.voidupdateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName, Map<String,BinaryFieldMetadata> fieldTypeIds, boolean isEnum, @Nullable Map<String,Integer> enumMap)voidupdateMetadata(File metadataDir, BooleanSupplier stopChecker)Merge the binary metadata files stored in the specified directory.@Nullable IgniteNodeValidationResultvalidateNode(ClusterNode rmtNode, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.voidwaitMetadataWriteIfNeeded(int typeId)Forces caller thread to wait for binary metadata write operation for given type ID.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, onKernalStop, printMemoryStats, toString, validateNode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.GridComponent
onKernalStop, printMemoryStats, validateNode
-
-
-
-
Field Detail
-
DFLT_WAIT_SCHEMA_UPDATE
public static final int DFLT_WAIT_SCHEMA_UPDATE
-
BINARY_METADATA_VIEW
public static final String BINARY_METADATA_VIEW
- See Also:
BinaryMetadataView
-
BINARY_METADATA_DESC
public static final String BINARY_METADATA_DESC
- See Also:
BinaryMetadataView, Constant Field Values
-
useTestBinaryCtx
public static boolean useTestBinaryCtx
For tests.
-
-
Constructor Detail
-
CacheObjectBinaryProcessorImpl
public CacheObjectBinaryProcessorImpl(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
resolveBinaryWorkDir
public static File resolveBinaryWorkDir(String igniteWorkDir, String consId)
- Parameters:
igniteWorkDir- Basic ignite working directory.consId- Node consistent id.- Returns:
- Working directory.
-
binaryWorkDir
public static File binaryWorkDir(String igniteWorkDir, String consId)
- Parameters:
igniteWorkDir- Basic ignite working directory.consId- Node consistent id.- Returns:
- Working directory.
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
addBinaryMetadataUpdateListener
public void addBinaryMetadataUpdateListener(BinaryMetadataUpdatedListener lsnr)
Add binary metadata update listener.- Specified by:
addBinaryMetadataUpdateListenerin interfaceIgniteCacheObjectProcessor- Parameters:
lsnr- Listener.
-
stop
public void stop(boolean cancel)
Stops grid component.- Specified by:
stopin interfaceGridComponent- Overrides:
stopin classGridProcessorAdapter- Parameters:
cancel- Iftrue, then all ongoing tasks or jobs for relevant components need to be cancelled.
-
onDisconnected
public void onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.- Specified by:
onDisconnectedin interfaceGridComponent- Overrides:
onDisconnectedin classGridProcessorAdapter- Parameters:
reconnectFut- Reconnect future.
-
onReconnected
public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException
Client reconnected callback.- Specified by:
onReconnectedin interfaceGridComponent- Overrides:
onReconnectedin classGridProcessorAdapter- Parameters:
clusterRestarted- Cluster restarted flag.- Returns:
- Future to wait before completing reconnect future.
- Throws:
IgniteCheckedException- If failed.
-
onKernalStart
public void onKernalStart(boolean active) throws IgniteCheckedExceptionCallback that notifies that kernal has successfully started, including all managers and processors.- Specified by:
onKernalStartin interfaceGridComponent- Overrides:
onKernalStartin classGridProcessorAdapter- Parameters:
active- Cluster active flag (note: should be used carefully since state can change concurrently).- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
prepareForCache
@Nullable public @Nullable CacheObject prepareForCache(@Nullable @Nullable CacheObject obj, GridCacheContext cctx)
Prepares cache object for cache (e.g. copies user-provided object if needed).- Specified by:
prepareForCachein interfaceIgniteCacheObjectProcessor- Parameters:
obj- Cache object.cctx- Cache context.- Returns:
- Object to be store in cache.
-
typeId
public int typeId(String typeName)
- Specified by:
typeIdin interfaceIgniteCacheObjectProcessor- Parameters:
typeName- Type name.- Returns:
- Type ID.
-
immutable
public boolean immutable(Object obj)
- Specified by:
immutablein interfaceIgniteCacheObjectProcessor- Parameters:
obj- Value.- Returns:
Trueif object is of known immutable type.
-
onContinuousProcessorStarted
public void onContinuousProcessorStarted(GridKernalContext ctx)
- Specified by:
onContinuousProcessorStartedin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Context.
-
marshal
public byte[] marshal(@Nullable @Nullable Object obj) throws BinaryObjectException- Parameters:
obj- Object.- Returns:
- Bytes.
- Throws:
BinaryObjectException- If failed.
-
unmarshal
public Object unmarshal(long ptr, boolean forceHeap) throws BinaryObjectException
- Parameters:
ptr- Off-heap pointer.forceHeap- Iftruecreates heap-based object.- Returns:
- Object.
- Throws:
BinaryObjectException- If failed.
-
marshalToBinary
public Object marshalToBinary(@Nullable @Nullable Object obj, boolean failIfUnregistered) throws BinaryObjectException
- Specified by:
marshalToBinaryin interfaceIgniteCacheObjectProcessor- Parameters:
obj- Original object.failIfUnregistered- Throw exception if class isn't registered.- Returns:
- Binary object (in case binary marshaller is used).
- Throws:
BinaryObjectException
-
marshaller
public GridBinaryMarshaller marshaller()
- Returns:
- Marshaller.
-
builder
public BinaryObjectBuilder builder(String clsName)
- Specified by:
builderin interfaceIgniteCacheObjectProcessor- Parameters:
clsName- Class name.- Returns:
- Builder.
-
builder
public BinaryObjectBuilder builder(BinaryObject binaryObj)
Creates builder initialized by existing binary object.- Specified by:
builderin interfaceIgniteCacheObjectProcessor- Parameters:
binaryObj- Binary object to edit.- Returns:
- Binary builder.
-
updateMetadata
public void updateMetadata(int typeId, String typeName, @Nullable @Nullable String affKeyFieldName, Map<String,BinaryFieldMetadata> fieldTypeIds, boolean isEnum, @Nullable @Nullable Map<String,Integer> enumMap) throws BinaryObjectException- Specified by:
updateMetadatain interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.typeName- Type name.affKeyFieldName- Affinity key field name.fieldTypeIds- Fields map.isEnum- Enum flag.enumMap- Enum name to ordinal mapping.- Throws:
BinaryObjectException
-
addMeta
public void addMeta(int typeId, BinaryType newMeta, boolean failIfUnregistered) throws BinaryObjectException- Specified by:
addMetain interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.newMeta- New metadata.failIfUnregistered- Fail if unregistered.- Throws:
BinaryObjectException
-
addMetaLocally
public void addMetaLocally(int typeId, BinaryType newMeta) throws BinaryObjectExceptionAdds metadata locally without triggering discovery exchange. Must be used only during startup and only if it is guaranteed that all nodes have the same copy of BinaryType.- Specified by:
addMetaLocallyin interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.newMeta- New metadata.- Throws:
BinaryObjectException
-
metadata
@Nullable public @Nullable BinaryType metadata(int typeId)
- Specified by:
metadatain interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.- Returns:
- Metadata.
-
waitMetadataWriteIfNeeded
public void waitMetadataWriteIfNeeded(int typeId)
Forces caller thread to wait for binary metadata write operation for given type ID. In case of in-memory mode this method becomes a No-op as no binary metadata is written to disk in this mode.- Parameters:
typeId- ID of binary type to wait for metadata write operation.
-
metadata0
@Nullable public @Nullable BinaryMetadata metadata0(int typeId)
- Parameters:
typeId- Type ID.- Returns:
- Metadata.
- Throws:
IgniteException- In case of error.
-
metadata
@Nullable public @Nullable BinaryType metadata(int typeId, int schemaId)
- Specified by:
metadatain interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.schemaId- Schema ID.- Returns:
- Metadata.
-
metadata
public Map<Integer,BinaryType> metadata(Collection<Integer> typeIds) throws BinaryObjectException
- Specified by:
metadatain interfaceIgniteCacheObjectProcessor- Parameters:
typeIds- Type ID.- Returns:
- Metadata.
- Throws:
BinaryObjectException
-
metadata
public Collection<BinaryType> metadata() throws BinaryObjectException
- Specified by:
metadatain interfaceIgniteCacheObjectProcessor- Returns:
- Metadata for all types.
- Throws:
BinaryObjectException
-
binaryMetadata
public Collection<BinaryMetadata> binaryMetadata() throws BinaryObjectException
- Returns:
- Cluster binary metadata.
- Throws:
BinaryObjectException- on error.
-
binaryMetadata
public BinaryMetadata binaryMetadata(int typeId) throws BinaryObjectException
- Returns:
- Binary metadata for specified type.
- Throws:
BinaryObjectException- on error.
-
saveMetadata
public void saveMetadata(Collection<BinaryType> types, File dir)
- Specified by:
saveMetadatain interfaceIgniteCacheObjectProcessor- Parameters:
types- Collection of binary types to write to.dir- Destination directory.
-
updateMetadata
public void updateMetadata(File metadataDir, BooleanSupplier stopChecker) throws IgniteCheckedException
Merge the binary metadata files stored in the specified directory.- Specified by:
updateMetadatain interfaceIgniteCacheObjectProcessor- Parameters:
metadataDir- Directory containing binary metadata files.stopChecker- Process interrupt checker.- Throws:
IgniteCheckedException- If failed.
-
cacheMetadataLocally
public void cacheMetadataLocally(File metadataDir, int typeId) throws IgniteCheckedException
Merge the binary metadata file stored in the specified directory.- Specified by:
cacheMetadataLocallyin interfaceIgniteCacheObjectProcessor- Parameters:
metadataDir- Directory containing binary metadata files.typeId- Type id to update.- Throws:
IgniteCheckedException- If failed.
-
buildEnum
public BinaryObject buildEnum(String typeName, int ord) throws BinaryObjectException
- Specified by:
buildEnumin interfaceIgniteCacheObjectProcessor- Parameters:
typeName- Type name.ord- ordinal.- Returns:
- Enum object.
- Throws:
BinaryObjectException
-
buildEnum
public BinaryObject buildEnum(String typeName, String name) throws BinaryObjectException
- Specified by:
buildEnumin interfaceIgniteCacheObjectProcessor- Parameters:
typeName- Type name.name- Name.- Returns:
- Enum object.
- Throws:
BinaryObjectException
-
registerEnum
public BinaryType registerEnum(String typeName, Map<String,Integer> vals) throws BinaryObjectException
Register enum type- Specified by:
registerEnumin interfaceIgniteCacheObjectProcessor- Parameters:
typeName- Type name.vals- Mapping of enum constant names to ordinals.- Returns:
- Binary Type for registered enum.
- Throws:
BinaryObjectException
-
binary
public IgniteBinary binary() throws IgniteException
- Specified by:
binaryin interfaceIgniteCacheObjectProcessor- Returns:
- Ignite binary interface.
- Throws:
IgniteException- If failed.
-
isBinaryObject
public boolean isBinaryObject(Object obj)
Checks whether object is binary object.- Specified by:
isBinaryObjectin interfaceIgniteCacheObjectProcessor- Parameters:
obj- Object to check.- Returns:
Trueif object is already a binary object,falseotherwise.
-
isBinaryEnabled
public boolean isBinaryEnabled(CacheConfiguration<?,?> ccfg)
Checks whether given class is binary.- Specified by:
isBinaryEnabledin interfaceIgniteCacheObjectProcessor- Returns:
trueIf binary objects are enabled.
-
affinityKeyField
public BinaryField affinityKeyField(int typeId)
Get affinity key field.- Parameters:
typeId- Binary object type ID.- Returns:
- Affinity key.
-
typeId
public int typeId(Object obj)
- Specified by:
typeIdin interfaceIgniteCacheObjectProcessor- Parameters:
obj- Object to get type ID for.- Returns:
- Type ID.
-
field
public Object field(Object obj, String fieldName)
- Specified by:
fieldin interfaceIgniteCacheObjectProcessor- Parameters:
obj- Binary object to get field from.fieldName- Field name.- Returns:
- Field value.
-
hasField
public boolean hasField(Object obj, String fieldName)
Checks whether field is set in the object.- Specified by:
hasFieldin interfaceIgniteCacheObjectProcessor- Parameters:
obj- Object.fieldName- Field name.- Returns:
trueif field is set.
-
binaryContext
public BinaryContext binaryContext()
- Returns:
- Binary context.
-
contextForCache
public CacheObjectContext contextForCache(CacheConfiguration ccfg) throws IgniteCheckedException
- Specified by:
contextForCachein interfaceIgniteCacheObjectProcessor- Parameters:
ccfg- Cache configuration.- Returns:
- Cache object context.
- Throws:
IgniteCheckedException- If failed.
-
marshal
public byte[] marshal(CacheObjectValueContext ctx, Object val) throws IgniteCheckedException
- Specified by:
marshalin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache object context.val- Value.- Returns:
- Value bytes.
- Throws:
IgniteCheckedException- If failed.
-
unmarshal
public Object unmarshal(CacheObjectValueContext ctx, byte[] bytes, ClassLoader clsLdr) throws IgniteCheckedException
- Specified by:
unmarshalin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Context.bytes- Bytes.clsLdr- Class loader.- Returns:
- Unmarshalled object.
- Throws:
IgniteCheckedException- If failed.
-
toCacheKeyObject
public KeyCacheObject toCacheKeyObject(CacheObjectContext ctx, @Nullable @Nullable GridCacheContext cctx, Object obj, boolean userObj)
- Specified by:
toCacheKeyObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache objects context.cctx- Cache context if cache is available.obj- Key value.userObj- Iftruethen given object is object provided by user and should be copied before stored in cache.- Returns:
- Cache key object.
-
toCacheKeyObject0
protected KeyCacheObject toCacheKeyObject0(CacheObjectContext ctx, @Nullable @Nullable GridCacheContext cctx, Object obj, boolean userObj)
- Parameters:
obj- Object.userObj- Iftruethen given object is object provided by user and should be copied before stored in cache.- Returns:
- Key cache object.
-
toCacheObject
@Nullable public @Nullable CacheObject toCacheObject(CacheObjectContext ctx, @Nullable @Nullable Object obj, boolean userObj, boolean failIfUnregistered)
- Specified by:
toCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache context.obj- Object.userObj- Iftruethen given object is object provided by user and should be copied before stored in cache.failIfUnregistered- Throw exception if class isn't registered.- Returns:
- Cache object.
-
toCacheObject
public CacheObject toCacheObject(CacheObjectContext ctx, byte type, byte[] bytes)
- Specified by:
toCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache context.type- Object type.bytes- Object bytes.- Returns:
- Cache object.
-
toKeyCacheObject
public KeyCacheObject toKeyCacheObject(CacheObjectContext ctx, byte type, byte[] bytes) throws IgniteCheckedException
- Specified by:
toKeyCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache context.type- Object type.bytes- Object bytes.- Returns:
- Cache object.
- Throws:
IgniteCheckedException
-
toCacheObject
public CacheObject toCacheObject(CacheObjectContext ctx, ByteBuffer buf)
- Specified by:
toCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache context.buf- Buffer to read from.- Returns:
- Cache object.
-
toCacheObject
public IncompleteCacheObject toCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable @Nullable IncompleteCacheObject incompleteObj)
- Specified by:
toCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache object context.buf- Buffer.incompleteObj- Incomplete cache object ornullif it's a first read.- Returns:
- Incomplete cache object.
-
toKeyCacheObject
public IncompleteCacheObject toKeyCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable @Nullable IncompleteCacheObject incompleteObj) throws IgniteCheckedException
- Specified by:
toKeyCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache object context.buf- Buffer.incompleteObj- Incomplete cache object ornullif it's a first read.- Returns:
- Incomplete cache object.
- Throws:
IgniteCheckedException- If fail.
-
toCacheObject
@Nullable public @Nullable CacheObject toCacheObject(CacheObjectContext ctx, @Nullable @Nullable Object obj, boolean userObj)
- Specified by:
toCacheObjectin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Cache context.obj- Object.userObj- Iftruethen given object is object provided by user and should be copied before stored in cache.- Returns:
- Cache object.
-
unwrapTemporary
public Object unwrapTemporary(GridCacheContext ctx, Object obj) throws BinaryObjectException
Converts temporary off-heap object to heap-based.- Specified by:
unwrapTemporaryin interfaceIgniteCacheObjectProcessor- Parameters:
ctx- Context.obj- Object.- Returns:
- Heap-based object.
- Throws:
BinaryObjectException
-
toBinary
@Nullable public @Nullable Object toBinary(@Nullable @Nullable Object obj, boolean failIfUnregistered) throws IgniteException
- Parameters:
obj- Object.- Returns:
- Binary object.
- Throws:
IgniteException- In case of error.
-
validateNode
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode rmtNode, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.- Specified by:
validateNodein interfaceGridComponent- Overrides:
validateNodein classGridProcessorAdapter- Parameters:
rmtNode- Joining node.discoData- Joining node discovery data.- Returns:
- Validation result or
nullin case of success.
-
discoveryDataType
@Nullable public @Nullable GridComponent.DiscoveryDataExchangeType discoveryDataType()
Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methodsGridComponent.collectJoiningNodeData(DiscoveryDataBag)orGridComponent.collectGridNodeData(DiscoveryDataBag).- Specified by:
discoveryDataTypein interfaceGridComponent- Overrides:
discoveryDataTypein classGridProcessorAdapter- Returns:
- Unique component type for discovery data exchange.
-
collectGridNodeData
public void collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.- Specified by:
collectGridNodeDatain interfaceGridComponent- Overrides:
collectGridNodeDatain classGridProcessorAdapter- Parameters:
dataBag- container object to store discovery data in.
-
collectJoiningNodeData
public void collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.- Specified by:
collectJoiningNodeDatain interfaceGridComponent- Overrides:
collectJoiningNodeDatain classGridProcessorAdapter- Parameters:
dataBag- container object to store discovery data in.
-
onJoiningNodeDataReceived
public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.- Specified by:
onJoiningNodeDataReceivedin interfaceGridComponent- Overrides:
onJoiningNodeDataReceivedin classGridProcessorAdapter- Parameters:
data-DiscoveryDataBag.JoiningNodeDiscoveryDatainterface to retrieve discovery data of joining node.
-
onGridDataReceived
public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called on new node during discovery process).- Specified by:
onGridDataReceivedin interfaceGridComponent- Overrides:
onGridDataReceivedin classGridProcessorAdapter- Parameters:
data-DiscoveryDataBag.GridDiscoveryDatainterface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).
-
setBinaryMetadataFileStoreDir
public void setBinaryMetadataFileStoreDir(@Nullable @Nullable File binaryMetadataFileStoreDir)Sets path to binary metadata store configured by user, should include binary_meta and consistentId- Parameters:
binaryMetadataFileStoreDir- path to binary_meta
-
removeType
public void removeType(int typeId)
Remove registered binary type from grid. Attention: this is not safe feature, the grid must not contain binary objects with specified type, operations with specified type must not be processed on the cluster.- Specified by:
removeTypein interfaceIgniteCacheObjectProcessor- Parameters:
typeId- Type ID.
-
registerClass
public BinaryType registerClass(Class<?> cls) throws BinaryObjectException
Register binary type for specified class.- Specified by:
registerClassin interfaceIgniteCacheObjectProcessor- Parameters:
cls- Class.- Returns:
- Metadata.
- Throws:
BinaryObjectException- In case of error.
-
-