Class ExposeBatchSubmitManager

  • All Implemented Interfaces:

    
    public abstract class ExposeBatchSubmitManager<T>
    
                        

    Batch submit manager for batching high-frequency operations to reduce network requests.

    Features: 1. Debouncing: multiple calls within the specified delay are merged into a single submit. 2. State machine: uses clear state transitions to avoid race conditions. 3. Thread safety: uses a unified state lock for multi-thread safety. 4. Generic support: supports different data types for batch processing. 5. Ordering: uses LinkedHashSet to maintain insertion order. 6. Deduplication: automatically removes duplicate tasks (based on equals and hashCode). 7. Connection-aware: automatically pauses/resumes task processing based on connection status.

    State machine: IDLE ⇄ ACTIVE

    State descriptions: - IDLE: idle, no pending data, no scheduled tasks. - ACTIVE: active, has pending data or is currently processing.

    Since:

    5.30.0

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void addSubmitTask(T item) Adds data to the batch processing queue.
      void release() Releases external resources and cleans up internal state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • addSubmitTask

         void addSubmitTask(T item)

        Adds data to the batch processing queue.

        Parameters:
        item - the data to add
      • release

         void release()

        Releases external resources and cleans up internal state. Stops receiving connection status notifications, cancels pending tasks, and clears the waiting queue. Use when the batch submit functionality needs to be completely stopped.

        Note: After calling this method, BatchSubmitManager will immediately stop all task processing. All pending data will be cleared and will not be executed.