Skip to content

Commit

Permalink
Rename EWYK The AdaptiveExecutionStrategy (#6353)
Browse files Browse the repository at this point in the history
Rename EWYK to AdaptiveExecutionStrategy, which better represents the nature of the strategy.

Updated the documentation 
Refactored substrategy selection for code clarity.
Added notes about chaining strategies and thread starvation

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
gregw and sbordet committed Jun 16, 2021
1 parent a492473 commit a415606
Show file tree
Hide file tree
Showing 8 changed files with 625 additions and 517 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.util.thread.ExecutionStrategy;
import org.eclipse.jetty.util.thread.TryExecutor;
import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
import org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HTTP2Connection extends AbstractConnection implements WriteFlusher.Listener, Connection.UpgradeTo
{
protected static final Logger LOG = LoggerFactory.getLogger(HTTP2Connection.class);

// TODO remove this once we are sure EWYK is OK for http2
private static final boolean PEC_MODE = Boolean.getBoolean("org.eclipse.jetty.http2.PEC_MODE");

private final AutoLock lock = new AutoLock();
private final Queue<Runnable> tasks = new ArrayDeque<>();
private final HTTP2Producer producer = new HTTP2Producer();
Expand All @@ -64,9 +60,7 @@ public HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoin
this.parser = parser;
this.session = session;
this.bufferSize = bufferSize;
if (PEC_MODE)
executor = new TryExecutor.NoTryExecutor(executor);
this.strategy = new EatWhatYouKill(producer, executor);
this.strategy = new AdaptiveExecutionStrategy(producer, executor);
LifeCycle.start(strategy);
parser.init(ParserListener::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.util.thread.ExecutionStrategy;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.util.thread.strategy.EatWhatYouKill;
import org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -95,7 +95,7 @@ public ManagedSelector(SelectorManager selectorManager, int id)
_id = id;
SelectorProducer producer = new SelectorProducer();
Executor executor = selectorManager.getExecutor();
_strategy = new EatWhatYouKill(producer, executor);
_strategy = new AdaptiveExecutionStrategy(producer, executor);
addBean(_strategy, true);
}

Expand Down

0 comments on commit a415606

Please sign in to comment.