java.lang.Object
ai.attackframework.tools.burp.utils.concurrent.Workers

public final class Workers extends Object
Shared shutdown helpers for extension-owned background workers.

Centralizes the two termination patterns used across sinks, UI, and retry paths:

Both helpers are no-ops on null, swallow no other exceptions, and restore the current thread's interrupt flag when the wait is interrupted. Callers are expected to have already swapped the owning reference to null under their own lock so lazy restart (on the next write) is the path forward after shutdown.

  • Field Details

  • Method Details

    • awaitExecutorShutdown

      public static void awaitExecutorShutdown(ExecutorService executor, long timeoutMs)
      Cancels queued work and waits briefly for executor to terminate.

      Invokes ExecutorService.shutdownNow() and then ExecutorService.awaitTermination(long, TimeUnit) for timeoutMs milliseconds. If the wait is interrupted, the current thread's interrupt flag is restored and the method returns without throwing.

      Parameters:
      executor - executor to stop; ignored when null
      timeoutMs - maximum milliseconds to wait for termination; values <= 0 only request cancellation without waiting
    • awaitThreadJoin

      public static void awaitThreadJoin(Thread worker, long timeoutMs)
      Interrupts worker and waits briefly for it to exit.

      Invokes Thread.interrupt() and then Thread.join(long) for timeoutMs milliseconds. If the wait is interrupted, the current thread's interrupt flag is restored and the method returns without throwing.

      Parameters:
      worker - thread to stop; ignored when null
      timeoutMs - maximum milliseconds to wait for join; values <= 0 only signal interrupt without waiting