Class PlatformCallbackGateway


  • public class PlatformCallbackGateway
    extends Object
    Gateway to all platform-dependent callbacks. Implementers might extend this class and provide additional callbacks.
    • Field Detail

      • envPtr

        protected final long envPtr
        Environment pointer.
    • Constructor Detail

      • PlatformCallbackGateway

        public PlatformCallbackGateway​(long envPtr)
        Native gateway.
        Parameters:
        envPtr - Environment pointer.
    • Method Detail

      • environmentPointer

        public long environmentPointer()
        Get environment pointer.
        Returns:
        Environment pointer.
      • cacheStoreCreate

        public long cacheStoreCreate​(long memPtr)
        Create cache store.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer.
      • cacheStoreInvoke

        public int cacheStoreInvoke​(long memPtr)
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Result.
      • cacheStoreDestroy

        public void cacheStoreDestroy​(long objPtr)
        Parameters:
        objPtr - Object pointer.
      • cacheStoreSessionCreate

        public long cacheStoreSessionCreate()
        Creates cache store session.
        Returns:
        Session instance pointer.
      • cacheEntryFilterCreate

        public long cacheEntryFilterCreate​(long memPtr)
        Creates cache entry filter and returns a pointer.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer.
      • cacheEntryFilterApply

        public int cacheEntryFilterApply​(long memPtr)
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Result.
      • cacheEntryFilterDestroy

        public void cacheEntryFilterDestroy​(long ptr)
        Parameters:
        ptr - Pointer.
      • cacheInvoke

        public void cacheInvoke​(long memPtr)
        Invoke cache entry processor.
        Parameters:
        memPtr - Memory pointer.
      • computeTaskMap

        public void computeTaskMap​(long memPtr,
                                   PlatformTargetProxy ses)
        Perform native task map. Do not throw exceptions, serializing them to the output stream instead.
        Parameters:
        memPtr - Memory pointer.
        ses - Platform compute task session proxy.
      • computeTaskLocalJobResult

        public int computeTaskLocalJobResult​(long taskPtr,
                                             long jobPtr)
        Perform native task job result notification.
        Parameters:
        taskPtr - Task pointer.
        jobPtr - Job pointer.
        Returns:
        Job result enum ordinal.
      • computeTaskJobResult

        public int computeTaskJobResult​(long memPtr)
        Perform native task job result notification.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Job result enum ordinal.
      • computeTaskReduce

        public void computeTaskReduce​(long taskPtr)
        Perform native task reduce.
        Parameters:
        taskPtr - Task pointer.
      • computeTaskComplete

        public void computeTaskComplete​(long taskPtr,
                                        long memPtr)
        Complete task with native error.
        Parameters:
        taskPtr - Task pointer.
        memPtr - Memory pointer with exception data or 0 in case of success.
      • computeJobSerialize

        public int computeJobSerialize​(long jobPtr,
                                       long memPtr)
        Serialize native job.
        Parameters:
        jobPtr - Job pointer.
        memPtr - Memory pointer.
        Returns:
        True if serialization succeeded.
      • computeJobCreate

        public long computeJobCreate​(long memPtr)
        Create job in native platform.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer to job.
      • computeJobExecuteLocal

        public void computeJobExecuteLocal​(long jobPtr,
                                           long cancel,
                                           PlatformTargetProxy ses)
        Execute native job on a node other than where it was created.
        Parameters:
        jobPtr - Job pointer.
        cancel - Cancel flag.
        ses - Platform compute task session proxy.
      • computeJobExecute

        public void computeJobExecute​(long memPtr,
                                      PlatformTargetProxy ses)
        Execute native job on a node other than where it was created.
        Parameters:
        memPtr - Memory pointer.
        ses - Platform compute task session proxy.
      • computeOutFuncExecute

        public void computeOutFuncExecute​(long memPtr)
        Read compute func from stream, execute, and write results back to the same stream.
        Parameters:
        memPtr - Memory pointer.
      • computeActionExecute

        public void computeActionExecute​(long memPtr)
        Read compute action from stream, execute, and write results back to the same stream.
        Parameters:
        memPtr - Memory pointer.
      • computeJobCancel

        public void computeJobCancel​(long jobPtr)
        Cancel the job.
        Parameters:
        jobPtr - Job pointer.
      • computeJobDestroy

        public void computeJobDestroy​(long ptr)
        Destroy the job.
        Parameters:
        ptr - Pointer.
      • continuousQueryListenerApply

        public void continuousQueryListenerApply​(long memPtr)
        Invoke local callback.
        Parameters:
        memPtr - Memory pointer.
      • continuousQueryFilterCreate

        public long continuousQueryFilterCreate​(long memPtr)
        Create filter in native platform.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer to created filter.
      • continuousQueryFilterApply

        public long continuousQueryFilterApply​(long memPtr)
        Invoke remote filter.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Result.
      • continuousQueryFilterRelease

        public void continuousQueryFilterRelease​(long filterPtr)
        Release remote filter.
        Parameters:
        filterPtr - Filter pointer.
      • dataStreamerTopologyUpdate

        public void dataStreamerTopologyUpdate​(long ptr,
                                               long topVer,
                                               int topSize)
        Notify native data streamer about topology update.
        Parameters:
        ptr - Data streamer native pointer.
        topVer - Topology version.
        topSize - Topology size.
      • dataStreamerStreamReceiverInvoke

        public void dataStreamerStreamReceiverInvoke​(long ptr,
                                                     PlatformTargetProxy cache,
                                                     long memPtr,
                                                     boolean keepBinary)
        Invoke stream receiver.
        Parameters:
        cache - Cache object.
        memPtr - Stream pointer.
      • futureByteResult

        public void futureByteResult​(long futPtr,
                                     long res)
        Notify future with byte result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureBoolResult

        public void futureBoolResult​(long futPtr,
                                     long res)
        Notify future with boolean result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureShortResult

        public void futureShortResult​(long futPtr,
                                      long res)
        Notify future with short result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureCharResult

        public void futureCharResult​(long futPtr,
                                     long res)
        Notify future with byte result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureIntResult

        public void futureIntResult​(long futPtr,
                                    long res)
        Notify future with int result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureFloatResult

        public void futureFloatResult​(long futPtr,
                                      long res)
        Notify future with float result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureLongResult

        public void futureLongResult​(long futPtr,
                                     long res)
        Notify future with long result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureDoubleResult

        public void futureDoubleResult​(long futPtr,
                                       long res)
        Notify future with double result.
        Parameters:
        futPtr - Future pointer.
        res - Result.
      • futureObjectResult

        public void futureObjectResult​(long futPtr,
                                       long memPtr)
        Notify future with object result.
        Parameters:
        futPtr - Future pointer.
        memPtr - Memory pointer.
      • futureNullResult

        public void futureNullResult​(long futPtr)
        Notify future with null result.
        Parameters:
        futPtr - Future pointer.
      • futureError

        public void futureError​(long futPtr,
                                long memPtr)
        Notify future with error.
        Parameters:
        futPtr - Future pointer.
        memPtr - Pointer to memory with error information.
      • messagingFilterCreate

        public long messagingFilterCreate​(long memPtr)
        Creates message filter and returns a pointer.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer.
      • messagingFilterApply

        public int messagingFilterApply​(long ptr,
                                        long memPtr)
        Parameters:
        ptr - Pointer.
        memPtr - Memory pointer.
        Returns:
        Result.
      • messagingFilterDestroy

        public void messagingFilterDestroy​(long ptr)
        Parameters:
        ptr - Pointer.
      • eventFilterCreate

        public long eventFilterCreate​(long memPtr)
        Creates event filter and returns a pointer.
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Pointer.
      • eventFilterApply

        public int eventFilterApply​(long ptr,
                                    long memPtr)
        Parameters:
        ptr - Pointer.
        memPtr - Memory pointer.
        Returns:
        Result.
      • eventLocalListenerApply

        public long eventLocalListenerApply​(long memPtr)
        Parameters:
        memPtr - Memory pointer.
        Returns:
        Result.
      • eventFilterDestroy

        public void eventFilterDestroy​(long ptr)
        Parameters:
        ptr - Pointer.
      • nodeInfo

        public void nodeInfo​(long memPtr)
        Sends node info to native target.
        Parameters:
        memPtr - Ptr to a stream with serialized node.
      • onStart

        public void onStart​(Object proc,
                            long memPtr)
        Kernal start callback.
        Parameters:
        proc - Platform processor.
        memPtr - Memory pointer.
      • lifecycleEvent

        public void lifecycleEvent​(long ptr,
                                   int evt)
        Lifecycle event callback.
        Parameters:
        ptr - Holder pointer.
        evt - Event.
      • memoryReallocate

        public void memoryReallocate​(long memPtr,
                                     int cap)
        Re-allocate external memory chunk.
        Parameters:
        memPtr - Cross-platform pointer.
        cap - Capacity.
      • clusterNodeFilterApply

        public int clusterNodeFilterApply​(long memPtr)
        Invokes cluster node filter.
        Parameters:
        memPtr - Stream pointer.
      • extensionCallbackInLongOutLong

        public long extensionCallbackInLongOutLong​(int typ,
                                                   long arg1)
        Extension callback accepting single long argument and returning long result.
        Parameters:
        typ - Operation type.
        arg1 - Argument 1.
        Returns:
        Long result.
      • extensionCallbackInLongLongOutLong

        public long extensionCallbackInLongLongOutLong​(int typ,
                                                       long arg1,
                                                       long arg2)
        Extension callback accepting two long arguments and returning long result.
        Parameters:
        typ - Operation type.
        arg1 - Argument 1.
        arg2 - Argument 2.
        Returns:
        Long result.
      • onClientDisconnected

        public void onClientDisconnected()
        Notifies platform about client disconnect.
      • onClientReconnected

        public void onClientReconnected​(boolean clusterRestarted)
        Notifies platform about client reconnect.
        Parameters:
        clusterRestarted - Cluster restarted flag.
      • loggerLog

        public void loggerLog​(int level,
                              String message,
                              String category,
                              String errorInfo,
                              long memPtr)
        Logs to the platform.
        Parameters:
        level - Log level.
        message - Message.
        category - Category.
        errorInfo - Error info.
        memPtr - Pointer to optional payload (serialized exception).
      • loggerIsLevelEnabled

        public boolean loggerIsLevelEnabled​(int level)
        Gets a value indicating whether native logger has specified level enabled.
        Parameters:
        level - Log level.
      • onStop

        public void onStop()
        Kernal stop callback.
      • affinityFunctionInit

        public long affinityFunctionInit​(long memPtr,
                                         PlatformTargetProxy baseFunc)
        Initializes affinity function.
        Parameters:
        memPtr - Pointer to a stream with serialized affinity function.
        baseFunc - Optional func for base calls.
        Returns:
        Affinity function pointer.
      • affinityFunctionPartition

        public int affinityFunctionPartition​(long memPtr)
        Gets the partition from affinity function.
        Parameters:
        memPtr - Pointer to a stream with data.
        Returns:
        Partition number for a given key.
      • affinityFunctionAssignPartitions

        public void affinityFunctionAssignPartitions​(long memPtr)
        Assigns the affinity partitions.
        Parameters:
        memPtr - Pointer to a stream.
      • affinityFunctionRemoveNode

        public void affinityFunctionRemoveNode​(long memPtr)
        Removes the node from affinity function.
        Parameters:
        memPtr - Pointer to a stream.
      • affinityFunctionDestroy

        public void affinityFunctionDestroy​(long ptr)
        Destroys the affinity function.
        Parameters:
        ptr - Affinity function pointer.
      • pluginProcessorStop

        public void pluginProcessorStop​(boolean cancel)
        Stops plugin processor.
      • pluginProcessorIgniteStop

        public void pluginProcessorIgniteStop​(boolean cancel)
        Notifies plugin processor about Ignite stop.
      • consoleWrite

        public static void consoleWrite​(String str,
                                        boolean isErr)
        Redirects the console output to platform.
        Parameters:
        str - String to write.
        isErr - Whether this is stdErr or stdOut.
      • pluginCallback

        public long pluginCallback​(long callbackId,
                                   PlatformMemory outMem,
                                   PlatformMemory inMem)
        Invoke plugin callback by id.
        Parameters:
        callbackId - Id of a callback registered in Platform.
        outMem - Out memory (Java writes, platform reads).
        inMem - In memory (platform writes, Java reads).
      • platformCacheUpdate

        public void platformCacheUpdate​(long memPtr)
        Updates platform cache data.
        Parameters:
        memPtr - Ptr to a stream with serialized data.
      • platformCacheUpdateFromThreadLocal

        public void platformCacheUpdateFromThreadLocal​(long cacheIdAndPartition,
                                                       long verMajor,
                                                       long verMinor)
        Updates platform cache data.
        Parameters:
        cacheIdAndPartition - Cache id and partition.
        verMajor - Affinity version.
        verMinor - Affinity version minor part.
      • onCacheStopped

        public void onCacheStopped​(int cacheId,
                                   boolean cancel,
                                   boolean destroy)
        Notifies about cache stop.
        Parameters:
        cacheId - Cache id.
        cancel - Cancel flag.
        destroy - Cache destroy flag.
      • onAffinityTopologyVersionChanged

        public void onAffinityTopologyVersionChanged​(AffinityTopologyVersion version)
        Notifies about topology version update.
        Parameters:
        version - Affinity topology version.
      • binaryTypeGet

        public long binaryTypeGet​(long memPtr)
        Gets binary type by name.
        Parameters:
        memPtr - Ptr to a stream with serialized type name. Result is returned in the same stream.
      • enter

        protected void enter()
        Enter gateway.
      • leave

        protected void leave()
        Leave gateway.
      • block

        protected void block()
        Block gateway.