296569 - removeLifeCycleListener() has no effect

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1341 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jan Bartel 2010-03-05 11:41:40 +00:00
parent e2e5f03cc2
commit 435a0d256b
3 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,7 @@
jetty-7.0.2-SNAPSHOT
+ JSON parses NaN as null
+ 290765 Reset input for HttpExchange retry.
+ 296569 removeLifeCycleListener() has no effect
+ 296765 JMX Connector Server and ShutdownThread
+ 297421 Hide server/system classes from WebAppClassLoader.getResources
+ 297783 Handle HEAD reponses in HttpClient

View File

@ -130,7 +130,7 @@ public abstract class AbstractLifeCycle implements LifeCycle
public void removeLifeCycleListener(LifeCycle.Listener listener)
{
LazyList.removeFromArray(_listeners,listener);
_listeners = (LifeCycle.Listener[])LazyList.removeFromArray(_listeners,listener);
}
public String getState()

View File

@ -125,6 +125,27 @@ public class LifeCycleListenerTest extends TestCase
assertTrue("The lifecycle state is not stooped",lifecycle.isStopped());
}
public void testRemoveLifecycleListener ()
throws Exception
{
TestLifeCycle lifecycle = new TestLifeCycle();
TestListener listener = new TestListener();
lifecycle.addLifeCycleListener(listener);
lifecycle.start();
((StdErrLog)Log.getLog()).setHideStacks(true);
assertTrue("The starting event didn't occur",listener.starting);
lifecycle.removeLifeCycleListener(listener);
lifecycle.stop();
assertFalse("The stopping event occurred", listener.stopping);
}
private class TestLifeCycle extends AbstractLifeCycle
{
Exception cause;
@ -154,6 +175,8 @@ public class LifeCycleListenerTest extends TestCase
cause=e;
}
}
private class TestListener implements LifeCycle.Listener
{