Fix NPE when stopping with no resesrved threads (#1939)
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
969c2d8e6a
commit
0ef51b67dc
|
@ -212,9 +212,10 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
return false;
|
||||
|
||||
ReservedThread thread = _stack.pop();
|
||||
if (thread==null && task!=STOP)
|
||||
if (thread==null)
|
||||
{
|
||||
startReservedThread();
|
||||
if (task!=STOP)
|
||||
startReservedThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,29 +18,24 @@
|
|||
|
||||
package org.eclipse.jetty.util.thread;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.annotation.Stress;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ReservedThreadExecutorTest
|
||||
{
|
||||
private static final int SIZE = 2;
|
||||
|
|
Loading…
Reference in New Issue