Package com.yahoo.jdisc.core
Class ApplicationLoader
- java.lang.Object
-
- com.yahoo.jdisc.core.ApplicationLoader
-
- All Implemented Interfaces:
ContainerActivator
,BootstrapLoader
,CurrentContainer
public class ApplicationLoader extends java.lang.Object implements BootstrapLoader, ContainerActivator, CurrentContainer
- Author:
- Simon Thoresen Hult, bjorncs
-
-
Constructor Summary
Constructors Constructor Description ApplicationLoader(OsgiFramework osgiFramework, java.lang.Iterable<? extends com.google.inject.Module> guiceModules)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeactivatedContainer
activateContainer(ContainerBuilder builder)
Creates and activates aContainer
based on the providedContainerBuilder
.Application
application()
void
destroy()
ContainerWatchdogMetrics
getContainerWatchdogMetrics()
void
init(java.lang.String appLocation, boolean privileged)
ContainerBuilder
newContainerBuilder()
This method creates and returns a newContainerBuilder
object that has the necessary references to the application and its internal components.com.yahoo.jdisc.core.ContainerSnapshot
newReference(java.net.URI uri)
Returns a reference to the currently activeContainer
.OsgiFramework
osgiFramework()
void
start()
void
stop()
-
-
-
Constructor Detail
-
ApplicationLoader
public ApplicationLoader(OsgiFramework osgiFramework, java.lang.Iterable<? extends com.google.inject.Module> guiceModules)
-
-
Method Detail
-
newContainerBuilder
public ContainerBuilder newContainerBuilder()
Description copied from interface:ContainerActivator
This method creates and returns a newContainerBuilder
object that has the necessary references to the application and its internal components.- Specified by:
newContainerBuilder
in interfaceContainerActivator
- Returns:
- The created builder.
-
activateContainer
public DeactivatedContainer activateContainer(ContainerBuilder builder)
Description copied from interface:ContainerActivator
Creates and activates aContainer
based on the providedContainerBuilder
. By providing a null argument, this method can be used to deactivate the current Container. The returned object can be used to schedule a cleanup task that is executed once the the deactivated Container has terminated.- Specified by:
activateContainer
in interfaceContainerActivator
- Parameters:
builder
- The builder to activate.- Returns:
- The previous container, if any.
-
newReference
public com.yahoo.jdisc.core.ContainerSnapshot newReference(java.net.URI uri)
Description copied from interface:CurrentContainer
Returns a reference to the currently activeContainer
. UntilSharedResource.release()
has been called, the Container can not shut down.- Specified by:
newReference
in interfaceCurrentContainer
- Parameters:
uri
- The identifier used to match this Request to an appropriateClientProvider
orRequestHandler
. The hostname must be "localhost" or a fully qualified domain name.- Returns:
- A reference to the current Container.
-
init
public void init(java.lang.String appLocation, boolean privileged) throws java.lang.Exception
- Specified by:
init
in interfaceBootstrapLoader
- Throws:
java.lang.Exception
-
start
public void start() throws java.lang.Exception
- Specified by:
start
in interfaceBootstrapLoader
- Throws:
java.lang.Exception
-
stop
public void stop() throws java.lang.Exception
- Specified by:
stop
in interfaceBootstrapLoader
- Throws:
java.lang.Exception
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceBootstrapLoader
-
application
public Application application()
-
getContainerWatchdogMetrics
public ContainerWatchdogMetrics getContainerWatchdogMetrics()
-
osgiFramework
public OsgiFramework osgiFramework()
-
-