Issue #7124 - deprecate AbstractLifeCycleListener

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-11-25 10:01:52 +11:00
parent b365b3cf1b
commit 63069ad28a
4 changed files with 5 additions and 43 deletions

View File

@ -37,11 +37,6 @@ public class ServerListener implements LifeCycle.Listener
return _tokenFile;
}
@Override
public void lifeCycleStarting(LifeCycle event)
{
}
@Override
public void lifeCycleStarted(LifeCycle event)
{
@ -58,19 +53,4 @@ public class ServerListener implements LifeCycle.Listener
}
}
}
@Override
public void lifeCycleFailure(LifeCycle event, Throwable cause)
{
}
@Override
public void lifeCycleStopping(LifeCycle event)
{
}
@Override
public void lifeCycleStopped(LifeCycle event)
{
}
}

View File

@ -19,7 +19,6 @@ import java.util.Hashtable;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener;
import org.eclipse.jetty.util.component.LifeCycle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@ -41,14 +40,13 @@ public class Activator implements BundleActivator
{
//For test purposes, use a random port
Server server = new Server(0);
server.getConnectors()[0].addEventListener(new AbstractLifeCycleListener()
server.getConnectors()[0].addEventListener(new LifeCycle.Listener()
{
@Override
public void lifeCycleStarted(LifeCycle event)
{
System.setProperty("bundle.server.port", String.valueOf(((ServerConnector)event).getLocalPort()));
super.lifeCycleStarted(event);
}
});
ContextHandlerCollection contexts = new ContextHandlerCollection();

View File

@ -299,6 +299,10 @@ public abstract class AbstractLifeCycle implements LifeCycle
}
}
/**
* @deprecated this class is redundant now that {@link LifeCycle.Listener} has default methods.
*/
@Deprecated
public abstract static class AbstractLifeCycleListener implements LifeCycle.Listener
{
@Override

View File

@ -31,11 +31,6 @@ public class StopLifeCycle extends AbstractLifeCycle implements LifeCycle.Listen
addEventListener(this);
}
@Override
public void lifeCycleStarting(LifeCycle lifecycle)
{
}
@Override
public void lifeCycleStarted(LifeCycle lifecycle)
{
@ -48,19 +43,4 @@ public class StopLifeCycle extends AbstractLifeCycle implements LifeCycle.Listen
LOG.warn("Unable to stop", e);
}
}
@Override
public void lifeCycleFailure(LifeCycle lifecycle, Throwable cause)
{
}
@Override
public void lifeCycleStopping(LifeCycle lifecycle)
{
}
@Override
public void lifeCycleStopped(LifeCycle lifecycle)
{
}
}