java.lang.Object
ai.attackframework.tools.burp.utils.opensearch.RetryQueue

public final class RetryQueue extends Object
Per-index bounded queues for failed OpenSearch index operations. When a push fails, documents can be offered to the queue; a drain thread later retries them. When the queue is full, new documents are rejected.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RetryQueue(int maxSizePerIndex)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if all known queues are empty.
    void
    Clears all queued retry documents across all indexes.
    boolean
    isEmpty(String indexName)
    Returns true if the queue for the given index is empty or absent.
    boolean
    offer(String indexName, Map<String,Object> document)
    Offers a single document to the queue for the given index.
    int
    offerAll(String indexName, List<Map<String,Object>> documents)
    Offers multiple documents to the queue for the given index.
    pollBatch(String indexName, int maxSize)
    Removes up to maxSize documents from the queue for the given index.
    int
    size(String indexName)
    Returns the current number of documents queued for the given index.
    int
    Returns total number of queued documents across all indexes (for logging).

    Methods inherited from class java.lang.Object

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

    • RetryQueue

      public RetryQueue(int maxSizePerIndex)
  • Method Details

    • offer

      public boolean offer(String indexName, Map<String,Object> document)
      Offers a single document to the queue for the given index.
      Parameters:
      indexName - full index name (e.g. attackframework-tool-burp-traffic)
      document - document to retry later
      Returns:
      true if accepted, false if queue full
    • offerAll

      public int offerAll(String indexName, List<Map<String,Object>> documents)
      Offers multiple documents to the queue for the given index. Stops at first failure (queue full); earlier docs may have been added.
      Parameters:
      indexName - full index name
      documents - documents to retry later
      Returns:
      number of documents actually accepted (0 to documents.size())
    • pollBatch

      public List<Map<String,Object>> pollBatch(String indexName, int maxSize)
      Removes up to maxSize documents from the queue for the given index.
      Parameters:
      indexName - full index name
      maxSize - maximum number of documents to poll
      Returns:
      list of documents (may be empty, never null)
    • size

      public int size(String indexName)
      Returns the current number of documents queued for the given index.
    • isEmpty

      public boolean isEmpty(String indexName)
      Returns true if the queue for the given index is empty or absent.
    • allEmpty

      public boolean allEmpty()
      Returns true if all known queues are empty.
    • totalSize

      public int totalSize()
      Returns total number of queued documents across all indexes (for logging).
    • clearAll

      public void clearAll()
      Clears all queued retry documents across all indexes.