415194 Deployer gives management of context to context collection
This commit is contained in:
parent
e34ba252a2
commit
2761abb658
|
@ -25,18 +25,22 @@ import org.eclipse.jetty.server.handler.ContextHandler;
|
|||
|
||||
public class StandardStarter implements AppLifeCycle.Binding
|
||||
{
|
||||
@Override
|
||||
public String[] getBindingTargets()
|
||||
{
|
||||
return new String[]
|
||||
{ "starting" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processBinding(Node node, App app) throws Exception
|
||||
{
|
||||
ContextHandler handler = app.getContextHandler();
|
||||
if (!handler.isStarted())
|
||||
{
|
||||
|
||||
// start the handler
|
||||
handler.start();
|
||||
}
|
||||
|
||||
// After starting let the context manage state
|
||||
app.getDeploymentManager().getContexts().manage(handler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,22 @@ import org.eclipse.jetty.server.handler.ContextHandler;
|
|||
|
||||
public class StandardStopper implements AppLifeCycle.Binding
|
||||
{
|
||||
@Override
|
||||
public String[] getBindingTargets()
|
||||
{
|
||||
return new String[]
|
||||
{ "stopping" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processBinding(Node node, App app) throws Exception
|
||||
{
|
||||
ContextHandler handler = app.getContextHandler();
|
||||
if (!handler.isStopped())
|
||||
{
|
||||
|
||||
// Before stopping, take back management from the context
|
||||
app.getDeploymentManager().getContexts().unmanage(handler);
|
||||
|
||||
// Stop it
|
||||
handler.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,15 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
* <p>
|
||||
* If adding a bean that is shared between multiple {@link ContainerLifeCycle} instances, then it should be started before being added, so it is unmanaged, or
|
||||
* the API must be used to explicitly set it as unmanaged.
|
||||
* <p>
|
||||
* This class also provides utility methods to dump deep structures of objects. It the dump, the following symbols are used to indicate the type of contained object:
|
||||
* <pre>
|
||||
* SomeContainerLifeCycleInstance
|
||||
* +- contained POJO instance
|
||||
* += contained MANAGED object, started and stopped with this instance
|
||||
* +~ referenced UNMANAGED object, with separate lifecycle
|
||||
* +? referenced AUTO object that could become MANAGED or UNMANAGED.
|
||||
* </pre>
|
||||
*/
|
||||
@ManagedObject("Implementation of Container and LifeCycle")
|
||||
public class ContainerLifeCycle extends AbstractLifeCycle implements Container, Destroyable, Dumpable
|
||||
|
|
Loading…
Reference in New Issue