Skip to content

Commit

Permalink
Issue #5859 Add trivial test
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Jan 18, 2021
1 parent b688d95 commit f60cf57
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
Expand Down Expand Up @@ -833,6 +834,24 @@ public void testDump() throws Exception
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1));
}

@Test
public void testContextClassLoader() throws Exception
{
QueuedThreadPool tp = new QueuedThreadPool();
tp.setMinThreads(1);
tp.setMaxThreads(2);
tp.setIdleTimeout(1000);
tp.setThreadsPriority(Thread.NORM_PRIORITY - 1);
try (StacklessLogging stackless = new StacklessLogging(QueuedThreadPool.class))
{
tp.start();
tp.execute(() ->
{
assertThat(Thread.currentThread().getContextClassLoader(), Matchers.equalTo(QueuedThreadPool.class.getClassLoader()));
});
}
}

private int count(String s, String p)
{
int c = 0;
Expand Down

0 comments on commit f60cf57

Please sign in to comment.