AHeise commented on a change in pull request #9772: Flink 14199: Only use
dedicated/named classes for mailbox letters.
URL: https://github.com/apache/flink/pull/9772#discussion_r329003119
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/execution/MailboxExecutor.java
##########
@@ -91,4 +122,30 @@
* @return only true if called from the mailbox thread.
*/
boolean isMailboxThread();
+
+ /**
+ * Creates a view on the executor that adds a constant {@code
toString()} to submitted executables.
+ *
+ * <p>This method should be used to provide a debuggable name when
requiring an {@link Executor} (for example,
+ * for {@link java.util.concurrent.CompletableFuture}).</p>
+ *
+ * @param name the bound name.
+ * @return the executor view.
+ */
+ default Executor asNamedExecutor(String name) {
+ return command ->
MailboxExecutor.this.execute(namedRunnable(command, name));
+ }
+
+ /**
+ * Creates a view on the executor that adds a constant {@code
toString()} to submitted executables.
+ *
+ * <p>This method should be used to provide a debuggable name when
requiring an {@link Executor} (for example,
+ * for {@link java.util.concurrent.CompletableFuture}).</p>
+ *
+ * @param nameSupplier the lazily evaluated, bound name.
+ * @return the executor view.
+ */
+ default Executor asNamedExecutor(Supplier<String> nameSupplier) {
+ return command ->
MailboxExecutor.this.execute(namedRunnable(command, nameSupplier));
Review comment:
I added a test case now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services