You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/03/28 06:33:08 UTC

[bookkeeper] branch master updated: Added executeOrdered to complement submitOrdered

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 31b7db6  Added executeOrdered to complement submitOrdered
31b7db6 is described below

commit 31b7db6dffd1eb3169e4304c9864462f56866fc9
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Tue Mar 27 23:33:01 2018 -0700

    Added executeOrdered to complement submitOrdered
    
    In many cases, we are not interested in the `ListenableFuture` returned by `submitOrdered()` call. In these cases we can avoid creating the future object which will be ignored by calling the `execute()` instead of `submit()` on the underlying executor.
    
    Author: Matteo Merli <mm...@apache.org>
    
    Reviewers: Ivan Kelly <iv...@apache.org>, Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #1290 from merlimat/execute-ordered
---
 .../org/apache/bookkeeper/common/util/OrderedScheduler.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java b/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
index b24fb95..bf2a6fb 100644
--- a/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
+++ b/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
@@ -330,6 +330,16 @@ public class OrderedScheduler implements ScheduledExecutorService {
     }
 
     /**
+     * schedules a one time action to execute with an ordering guarantee on the <tt>orderingKey</tt>.
+     *
+     * @param orderingKey order key to submit the task
+     * @param r task to run
+     */
+    public void executeOrdered(Object orderingKey, SafeRunnable r) {
+        chooseThread(orderingKey).execute(timedRunnable(r));
+    }
+
+    /**
      * schedules a one time action to execute with an ordering guarantee on the key.
      *
      * @param orderingKey

-- 
To stop receiving notification emails like this one, please contact
sijie@apache.org.