Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().

Added test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-08-06 11:50:29 +02:00
parent 6c1b5982a5
commit f484b83c2e
1 changed files with 23 additions and 0 deletions

View File

@ -652,4 +652,27 @@ public class ContainerLifeCycleTest
assertThat(root.getContainedBeans(Integer.class), containsInAnyOrder(Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4)));
assertThat(root.getContainedBeans(String.class), containsInAnyOrder("leaf"));
}
@Test
public void testBeanStoppingAddedToStartingBean() throws Exception
{
ContainerLifeCycle longLived = new ContainerLifeCycle()
{
@Override
protected void doStop() throws Exception
{
super.doStop();
ContainerLifeCycle shortLived = new ContainerLifeCycle();
shortLived.addBean(this);
shortLived.start();
assertTrue(shortLived.isStarted());
assertTrue(isStopping());
assertFalse(shortLived.isManaged(this));
}
};
longLived.start();
longLived.stop();
}
}