HttpChannel, AdaptiveExecutionStrategy: improve profiler-friendliness
In an application with multiple Jetty instances in one JVM (e.g. integration test) when examining stack frames using the debugger or profiler, most samples that involve user code will have these two frames in their stack. Unfortunately, with a lambda, the different Jetty instances actually have different class names for different lambdas, which causes stack analysis to falsely think the frames are different. It's a little uglier, but by replacing these two specific lambdas with anonymous classes with a stable name, the profiler is able to see that the frames are in fact the same and collapse them, improving observability.
This commit is contained in:
parent
218c8d0fb0
commit
5db0c7b552
|
@ -494,15 +494,19 @@ public abstract class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
if (!_request.hasMetaData())
|
||||
throw new IllegalStateException("state=" + _state);
|
||||
|
||||
dispatch(DispatcherType.REQUEST, () ->
|
||||
dispatch(DispatcherType.REQUEST, new Dispatchable()
|
||||
{
|
||||
for (HttpConfiguration.Customizer customizer : _configuration.getCustomizers())
|
||||
@Override
|
||||
public void dispatch() throws IOException, ServletException
|
||||
{
|
||||
customizer.customize(getConnector(), _configuration, _request);
|
||||
if (_request.isHandled())
|
||||
return;
|
||||
for (HttpConfiguration.Customizer customizer : _configuration.getCustomizers())
|
||||
{
|
||||
customizer.customize(getConnector(), _configuration, _request);
|
||||
if (_request.isHandled())
|
||||
return;
|
||||
}
|
||||
getServer().handle(HttpChannel.this);
|
||||
}
|
||||
getServer().handle(HttpChannel.this);
|
||||
});
|
||||
|
||||
break;
|
||||
|
|
|
@ -137,7 +137,14 @@ public class AdaptiveExecutionStrategy extends ContainerLifeCycle implements Exe
|
|||
private final Executor _executor;
|
||||
private final TryExecutor _tryExecutor;
|
||||
private final Executor _virtualExecutor;
|
||||
private final Runnable _runPendingProducer = () -> tryProduce(true);
|
||||
private final Runnable _runPendingProducer = new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
tryProduce(true);
|
||||
}
|
||||
};
|
||||
private State _state = State.IDLE;
|
||||
private boolean _pending;
|
||||
|
||||
|
|
Loading…
Reference in New Issue