Class MessageSlicer

    • Field Detail

      • DEFAULT_MAX_SLICING_TRIES

        public static final int DEFAULT_MAX_SLICING_TRIES
        See Also:
        Constant Field Values
    • Method Detail

      • builder

        public static MessageSlicer.Builder builder()
        Returns a new Builder for creating MessageSlicer instances.
        Returns:
        a Builder instance
      • isHandledMessage

        public static boolean isHandledMessage​(Object message)
        Checks if the given message is handled by this class. If so, it should be forwarded to the handleMessage(Object) method
        Parameters:
        message - the message to check
        Returns:
        true if handled, false otherwise
      • slice

        public boolean slice​(SliceOptions options)
        Slices a message into chunks based on the serialized size, the maximum message slice size and the given options.
        Parameters:
        options - the SliceOptions
        Returns:
        true if the message was sliced, false otherwise
      • handleMessage

        public boolean handleMessage​(Object message)
        Invoked to handle messages pertaining to this class.
        Parameters:
        message - the message
        Returns:
        true if the message was handled, false otherwise
      • checkExpiredSlicedMessageState

        public void checkExpiredSlicedMessageState()
        Checks for and removes sliced message state that has expired due to inactivity from the assembling component on the other end.
      • close

        public void close()
        Closes and removes all in-progress sliced message state.
        Specified by:
        close in interface AutoCloseable
      • cancelSlicing

        public void cancelSlicing​(@NonNull Predicate<Identifier> filter)
        Cancels all in-progress sliced message state that matches the given filter.
        Parameters:
        filter - filters by Identifier