Class GridIoManager

    • Constructor Detail

      • GridIoManager

        public GridIoManager​(GridKernalContext ctx)
        Parameters:
        ctx - Grid kernal context.
    • Method Detail

      • messageFactory

        public MessageFactory messageFactory()
        Returns:
        Message factory.
      • formatter

        public MessageFormatter formatter()
        Returns:
        Message writer factory.
      • resetMetrics

        public void resetMetrics()
        Resets metrics for this manager.
      • sendIoTest

        public IgniteInternalFuture sendIoTest​(List<ClusterNode> nodes,
                                               byte[] payload,
                                               boolean procFromNioThread)
        Parameters:
        nodes - Nodes.
        payload - Payload.
        procFromNioThread - If true message is processed from NIO thread.
        Returns:
        Response future.
      • sendIoTest

        public IgniteInternalFuture<List<IgniteIoTestMessage>> sendIoTest​(ClusterNode node,
                                                                          byte[] payload,
                                                                          boolean procFromNioThread)
        Parameters:
        node - Node.
        payload - Payload.
        procFromNioThread - If true message is processed from NIO thread.
        Returns:
        Response future.
      • runIoTest

        public void runIoTest​(long warmup,
                              long duration,
                              int threads,
                              long latencyLimit,
                              int rangesCnt,
                              int payLoadSize,
                              boolean procFromNioThread,
                              List<ClusterNode> nodes)
        Parameters:
        warmup - Warmup duration in milliseconds.
        duration - Test duration in milliseconds.
        threads - Thread count.
        latencyLimit - Max latency in nanoseconds.
        rangesCnt - Ranges count in resulting histogram.
        payLoadSize - Payload size in bytes.
        procFromNioThread - True to process requests in NIO threads.
        nodes - Nodes participating in test.
      • stop

        public void stop​(boolean cancel)
                  throws IgniteCheckedException
        Stops grid component.
        Parameters:
        cancel - If true, then all ongoing tasks or jobs for relevant components need to be cancelled.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • currentPolicy

        @Nullable
        public static @Nullable Byte currentPolicy()
        Returns:
        Current IO policy
      • openTransmissionSender

        public GridIoManager.TransmissionSender openTransmissionSender​(UUID remoteId,
                                                                       Object topic)
        Parameters:
        remoteId - The remote node to connect to.
        topic - The remote topic to connect to.
        Returns:
        The channel instance to communicate with remote.
      • addTransmissionHandler

        public void addTransmissionHandler​(Object topic,
                                           TransmissionHandler hnd)
        Parameters:
        topic - The GridTopic to register handler to.
        hnd - Handler which will handle file upload requests.
      • removeTransmissionHandler

        public void removeTransmissionHandler​(Object topic)
        Parameters:
        topic - The topic to erase handler from.
      • sendToCustomTopic

        public void sendToCustomTopic​(UUID nodeId,
                                      Object topic,
                                      Message msg,
                                      byte plc)
                               throws IgniteCheckedException
        Parameters:
        nodeId - Id of destination node.
        topic - Topic to send the message to.
        msg - Message to send.
        plc - Type of processing.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • sendToGridTopic

        public void sendToGridTopic​(UUID nodeId,
                                    GridTopic topic,
                                    Message msg,
                                    byte plc)
                             throws IgniteCheckedException
        Parameters:
        nodeId - Id of destination node.
        topic - Topic to send the message to.
        msg - Message to send.
        plc - Type of processing.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • sendGeneric

        public void sendGeneric​(ClusterNode node,
                                Object topic,
                                int topicOrd,
                                Message msg,
                                byte plc)
                         throws IgniteCheckedException
        Parameters:
        node - Destination node.
        topic - Topic to send the message to.
        topicOrd - GridTopic enumeration ordinal.
        msg - Message to send.
        plc - Type of processing. *
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • sendOrderedMessage

        public void sendOrderedMessage​(ClusterNode node,
                                       Object topic,
                                       Message msg,
                                       byte plc,
                                       long timeout,
                                       boolean skipOnTimeout)
                                throws IgniteCheckedException
        Parameters:
        node - Destination node.
        topic - Topic to send the message to.
        msg - Message to send.
        plc - Type of processing.
        timeout - Timeout to keep a message on receiving queue.
        skipOnTimeout - Whether message can be skipped on timeout.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • sendOrderedMessage

        public void sendOrderedMessage​(ClusterNode node,
                                       Object topic,
                                       Message msg,
                                       byte plc,
                                       long timeout,
                                       boolean skipOnTimeout,
                                       IgniteInClosure<IgniteException> ackC)
                                throws IgniteCheckedException
        Parameters:
        node - Destination node.
        topic - Topic to send the message to.
        msg - Message to send.
        plc - Type of processing.
        timeout - Timeout to keep a message on receiving queue.
        skipOnTimeout - Whether message can be skipped on timeout.
        ackC - Ack closure.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • sendUserMessage

        public void sendUserMessage​(Collection<? extends ClusterNode> nodes,
                                    Object msg,
                                    @Nullable
                                    @Nullable Object topic,
                                    boolean ordered,
                                    long timeout,
                                    boolean async)
                             throws IgniteCheckedException
        Sends a peer deployable user message.
        Parameters:
        nodes - Destination nodes.
        msg - Message to send.
        topic - Message topic to use.
        ordered - Is message ordered?
        timeout - Message timeout in milliseconds for ordered messages.
        async - Async flag.
        Throws:
        IgniteCheckedException - Thrown in case of any errors.
      • addUserMessageListener

        public void addUserMessageListener​(@Nullable
                                           @Nullable Object topic,
                                           @Nullable
                                           @Nullable IgniteBiPredicate<UUID,​?> p)
      • addUserMessageListener

        public void addUserMessageListener​(@Nullable
                                           @Nullable Object topic,
                                           @Nullable
                                           @Nullable IgniteBiPredicate<UUID,​?> p,
                                           UUID nodeId)
        Parameters:
        topic - Topic to subscribe to.
        p - Message predicate.
      • removeUserMessageListener

        public void removeUserMessageListener​(@Nullable
                                              @Nullable Object topic,
                                              IgniteBiPredicate<UUID,​?> p)
        Parameters:
        topic - Topic to unsubscribe from.
        p - Message predicate.
      • addMessageListener

        public void addMessageListener​(GridTopic topic,
                                       GridMessageListener lsnr)
        Parameters:
        topic - Listener's topic.
        lsnr - Listener to add.
      • addDisconnectListener

        public void addDisconnectListener​(GridDisconnectListener lsnr)
        Parameters:
        lsnr - Listener to add.
      • removeDisconnectListener

        public void removeDisconnectListener​(GridDisconnectListener lsnr)
        Parameters:
        lsnr - Listener to remove.
      • addMessageListener

        public void addMessageListener​(Object topic,
                                       GridMessageListener lsnr)
        Parameters:
        topic - Listener's topic.
        lsnr - Listener to add.
      • removeMessageListener

        public boolean removeMessageListener​(GridTopic topic)
        Parameters:
        topic - Message topic.
        Returns:
        Whether or not listener was indeed removed.
      • removeMessageListener

        public boolean removeMessageListener​(Object topic)
        Parameters:
        topic - Message topic.
        Returns:
        Whether or not listener was indeed removed.
      • removeMessageListener

        public boolean removeMessageListener​(GridTopic topic,
                                             @Nullable
                                             @Nullable GridMessageListener lsnr)
        Parameters:
        topic - Listener's topic.
        lsnr - Listener to remove.
        Returns:
        Whether or not the lsnr was removed.
      • removeMessageListener

        public boolean removeMessageListener​(Object topic,
                                             @Nullable
                                             @Nullable GridMessageListener lsnr)
        Parameters:
        topic - Listener's topic.
        lsnr - Listener to remove.
        Returns:
        Whether or not the lsnr was removed.
      • getSentMessagesCount

        public int getSentMessagesCount()
        Gets sent messages count.
        Returns:
        Sent messages count.
      • getSentBytesCount

        public long getSentBytesCount()
        Gets sent bytes count.
        Returns:
        Sent bytes count.
      • getReceivedMessagesCount

        public int getReceivedMessagesCount()
        Gets received messages count.
        Returns:
        Received messages count.
      • getReceivedBytesCount

        public long getReceivedBytesCount()
        Gets received bytes count.
        Returns:
        Received bytes count.
      • getOutboundMessagesQueueSize

        public int getOutboundMessagesQueueSize()
        Gets outbound messages queue size.
        Returns:
        Outbound messages queue size.
      • dumpStats

        public void dumpStats()
        Dumps SPI stats to diagnostic logs in case TcpCommunicationSpi is used, no-op otherwise.