Class FakeMailboxExecutor

java.lang.Object
io.github.flink.gcp.connector.testutils.FakeMailboxExecutor
All Implemented Interfaces:
org.apache.flink.api.common.operators.MailboxExecutor

@Internal public final class FakeMailboxExecutor extends Object implements org.apache.flink.api.common.operators.MailboxExecutor
A queue-backed MailboxExecutor for tests: execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions, org.apache.flink.util.function.ThrowingRunnable<? extends java.lang.Exception>, java.lang.String, java.lang.Object...) enqueues mails, yield() runs the next mail (blocking until one arrives, like the real mailbox), drain() runs every mail already enqueued, and quiesce() makes every later execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions, org.apache.flink.util.function.ThrowingRunnable<? extends java.lang.Exception>, java.lang.String, java.lang.Object...) throw the RejectedExecutionException the real mailbox throws once the task has quiesced it, which happens before the operators close.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.flink.api.common.operators.MailboxExecutor

    org.apache.flink.api.common.operators.MailboxExecutor.MailOptions
  • Field Summary

    Fields inherited from interface org.apache.flink.api.common.operators.MailboxExecutor

    EMPTY_ARGS
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs every mail already enqueued, mimicking the idle mailbox loop between records.
    void
    execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions options, org.apache.flink.util.function.ThrowingRunnable<? extends Exception> command, String descriptionFormat, Object... descriptionArgs)
     
    void
    Refuses every mail from now on, as the real mailbox does after the task's prepareClose().
    boolean
     
    boolean
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.flink.api.common.operators.MailboxExecutor

    execute, execute, execute, submit, submit, submit, submit
  • Constructor Details

    • FakeMailboxExecutor

      public FakeMailboxExecutor()
  • Method Details

    • execute

      public void execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions options, org.apache.flink.util.function.ThrowingRunnable<? extends Exception> command, String descriptionFormat, Object... descriptionArgs)
      Specified by:
      execute in interface org.apache.flink.api.common.operators.MailboxExecutor
    • quiesce

      public void quiesce()
      Refuses every mail from now on, as the real mailbox does after the task's prepareClose(). Mails already enqueued still run through yield() and drain().
    • yield

      public void yield() throws InterruptedException, org.apache.flink.util.FlinkRuntimeException
      Specified by:
      yield in interface org.apache.flink.api.common.operators.MailboxExecutor
      Throws:
      InterruptedException
      org.apache.flink.util.FlinkRuntimeException
    • tryYield

      public boolean tryYield() throws org.apache.flink.util.FlinkRuntimeException
      Specified by:
      tryYield in interface org.apache.flink.api.common.operators.MailboxExecutor
      Throws:
      org.apache.flink.util.FlinkRuntimeException
    • shouldInterrupt

      public boolean shouldInterrupt()
      Specified by:
      shouldInterrupt in interface org.apache.flink.api.common.operators.MailboxExecutor
    • drain

      public void drain()
      Runs every mail already enqueued, mimicking the idle mailbox loop between records.