Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/493#discussion_r99376024
  
    --- Diff: 
utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java ---
    @@ -141,6 +148,27 @@ public Repeater repeat(Callable<?> body) {
         }
     
         /**
    +     * Use a new thread for every iteration of the loop.
    +     *
    +     * @return {@literal this} to aid coding in a fluent style.
    +     */
    +    public Repeater threaded() {
    +        this.executor = Executors.newSingleThreadExecutor();
    +        this.shutdown = true;
    +        return this;
    +    }
    +
    +    /**
    +     * @see #threaded()
    +     * @param executor an externally managed {@link ExecutorService} to 
use when creating threads.
    +     * @return {@literal this} to aid coding in a fluent style.
    +     */
    +    public Repeater threaded(ExecutorService executor) {
    +        this.executor = executor;
    +        return this;
    --- End diff --
    
    A bit on the pedantic side - can you add `shutdown =false` here. Can 
imagine first calling `threaded()` and passing the builder to another method 
only to add a custom executor using `threaded(myExecutor)`. Good to merge after 
that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to