Interface Container
-
- All Superinterfaces:
SharedResource
,Timer
public interface Container extends SharedResource, Timer
This is the immutable Container. An instance of this class is attached to every
Request
, and as long as theAbstractResource.release()
method has not been called, that Container instance is actively kept alive to prevent any race conditions during reconfiguration or shutdown. At any time there is only a single active Container in the runningApplication
, and the only way to retrieve a reference to that Container is by callingCurrentContainer.newReference(URI)
. Instead of holding a local Container object inside aServerProvider
(which will eventually become stale), use theappropriate Request constructor
instead.The only way to create a new instance of this class is to 1) create and configure a
ContainerBuilder
, and 2) pass that to theContainerActivator.activateContainer(ContainerBuilder)
method.- Author:
- Simon Thoresen Hult
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.yahoo.jdisc.Timer
Timer.ClockAdapter
-
-
Field Summary
-
Fields inherited from interface com.yahoo.jdisc.SharedResource
DEBUG, SYSTEM_PROPERTY_NAME_DEBUG
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getInstance(com.google.inject.Key<T> key)
Returns the appropriate instance for the given injection key.<T> T
getInstance(java.lang.Class<T> type)
Returns the appropriate instance for the given injection type.RequestHandler
resolveHandler(Request request)
Attempts to find aRequestHandler
in the current server- (ifRequest.isServerRequest()
is true) or client- (ifRequest.isServerRequest()
is false)BindingSet
that matches the givenURI
.-
Methods inherited from interface com.yahoo.jdisc.SharedResource
refer, release
-
Methods inherited from interface com.yahoo.jdisc.Timer
currentTime, currentTimeMillis, toUtcClock
-
-
-
-
Method Detail
-
resolveHandler
RequestHandler resolveHandler(Request request)
Attempts to find aRequestHandler
in the current server- (ifRequest.isServerRequest()
is true) or client- (ifRequest.isServerRequest()
is false)BindingSet
that matches the givenURI
. If no match can be found, this method returns null.- Parameters:
request
- The Request to match against the boundRequestHandler
s.- Returns:
- The matching RequestHandler, or null if there is no match.
-
getInstance
<T> T getInstance(com.google.inject.Key<T> key)
Returns the appropriate instance for the given injection key. When feasible, avoid using this method in favor of having Guice inject your dependencies ahead of time.- Type Parameters:
T
- The class of the instance to return.- Parameters:
key
- The key of the instance to return.- Returns:
- The appropriate instance of the given class.
- Throws:
com.google.inject.ConfigurationException
- If this injector cannot find or create the provider.com.google.inject.ProvisionException
- If there was a runtime failure while providing an instance.
-
getInstance
<T> T getInstance(java.lang.Class<T> type)
Returns the appropriate instance for the given injection type. When feasible, avoid using this method in favor of having Guice inject your dependencies ahead of time.- Type Parameters:
T
- The class of the instance to return.- Parameters:
type
- The class object of the instance to return.- Returns:
- The appropriate instance of the given class.
- Throws:
com.google.inject.ConfigurationException
- If this injector cannot find or create the provider.com.google.inject.ProvisionException
- If there was a runtime failure while providing an instance.
-
-