-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rename EWYK The AdaptiveExecutionStrategy #6353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Rename EWYK The AdaptiveExecutionStrategy, which better represents the nature of the strategy. Signed-off-by: Greg Wilkins <gregw@webtide.com>
Rename EWYK The AdaptiveExecutionStrategy, which better represents the nature of the strategy. Signed-off-by: Greg Wilkins <gregw@webtide.com>
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
Updated the documentation from review, but in so doing realised that the sub-strategy selection could be more simply represented in code, so that was also updated. Signed-off-by: Greg Wilkins <gregw@webtide.com>
Updated the documentation from review, but in so doing realised that the sub-strategy selection could be more simply represented in code, so that was also updated. Signed-off-by: Greg Wilkins <gregw@webtide.com>
Updated the documentation from review, but in so doing realised that the sub-strategy selection could be more simply represented in code, so that was also updated. Signed-off-by: Greg Wilkins <gregw@webtide.com>
Added notes about chaining strategies and thread starvation Signed-off-by: Greg Wilkins <gregw@webtide.com>
Fixed formatting and made a little clearer Signed-off-by: Greg Wilkins <gregw@webtide.com>
Added deprecated version of EWYK Signed-off-by: Greg Wilkins <gregw@webtide.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/EatWhatYouKill.java
Outdated
Show resolved
Hide resolved
Updates from review Signed-off-by: Greg Wilkins <gregw@webtide.com>
jetty-util/src/main/java/org/eclipse/jetty/util/thread/AutoLock.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
Updates from review Signed-off-by: Greg Wilkins <gregw@webtide.com>
version without code duplication Signed-off-by: Greg Wilkins <gregw@webtide.com>
@sbordet I have pushed a version without the lock hack that well matches the documented algorithm. Note also with this forumulation there is one less test the common case for a non-blocking task, so it will take a much simpler path. The cost is that for the case of an potentially blocking task when there are no pending producers available, then the taskType is checked twice. This double check can be removed, but only by breaking out the EITHER and BLOCKING cases and thus duplicating the synchronized block and changing the flow from the documentation... but that may also be OK.... I'll add it as a comment to compare. |
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
Even more comments Some duplicated code to avoid double test on taskType Signed-off-by: Greg Wilkins <gregw@webtide.com>
hide the Runnable interface from the strategy signature Signed-off-by: Greg Wilkins <gregw@webtide.com>
fix accidental change Signed-off-by: Greg Wilkins <gregw@webtide.com>
refactor production and consumption methods to be smaller a better named/defined. Signed-off-by: Greg Wilkins <gregw@webtide.com>
@sbordet So I have re-re-re-reworked this class so:
Considering the effort expended on a "simple" rename, please give this version fair consideration before just saying: NAH let's keep the old one Note that I think there is some scope to manually unwind the production loop so that there is a blocking and a nonblocking version. I did give that a try, but code clarity suffered a lot and I think there would only be very marginal gains if any. The evidence is that the majority of productions are done with blocking invocations, so that path should be well optimized by the JIT without manual unwinding. |
updates from review Signed-off-by: Greg Wilkins <gregw@webtide.com>
@sbordet nudge... let's get this merged long before next release train |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart niggles in the comment/javadocs.
Since many javadocs were added, a general rule for javadocs is that they should be written in 3rd person, therefore "Selects a sub-strategy" rather than "Select a sub-strategy", "Runs" rather than "Run", etc.
See:
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#styleguide
https://blog.joda.org/2012/11/javadoc-coding-standards.html
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/strategy/AdaptiveExecutionStrategy.java
Outdated
Show resolved
Hide resolved
niggles for javadoc Signed-off-by: Greg Wilkins <gregw@webtide.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all javadocs were put in 3rd person, it's just to have a little more consistency, but I don't want to annoy too much. LGTM.
more niggles for javadoc Signed-off-by: Greg Wilkins <gregw@webtide.com>
Fixed javadoc 3rd person forms. Removed stale references to doProduce() method. Using IO.close(Closeable). Other small cosmetic changes. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet nudge |
@gregw I made further changes to the javadocs, see my commit. |
* @return True if the sub-strategy requires the caller to continue to produce tasks. | ||
*/ | ||
private boolean consumeTask(Runnable task, SubStrategy subStrategy) | ||
{ | ||
// Consume and/or execute task according to the selected mode. | ||
if (LOG.isDebugEnabled()) | ||
LOG.debug("{} ss={} t={}/{} {}", this, subStrategy, task, Invocable.getInvocationType(task)); | ||
LOG.debug("ss={} t={}/{} {}", subStrategy, task, Invocable.getInvocationType(task), this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbordet this is now inconsistent with the other debugs in the class.... but I guess that is not so important.
Rename EWYK to AdaptiveExecutionStrategy, which better represents the nature of the strategy.
#6391
Signed-off-by: Greg Wilkins gregw@webtide.com