Class AsyncRunLevelContext
java.lang.Object
org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<ActiveDescriptor<?>, Object> The backing maps for this context.private long
private final HashMap
<ActiveDescriptor<?>, Long> The set of services currently being createdprivate int
private CurrentTaskFutureWrapper
private static final boolean
private static final String
private static final Executor
private Executor
private final HashSet
<ActiveDescriptor<?>> The set of descriptors that have been hard cancelledprivate final Logger
private final Map
<ActiveDescriptor<?>, Throwable> private final ServiceLocator
private static final Logger
private int
private Integer
private final LinkedList
<ActiveDescriptor<?>> private static final ThreadFactory
private static final Timer
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AsyncRunLevelContext
(ServiceLocator locator) Constructor for the guy who does the work -
Method Summary
Modifier and TypeMethodDescription(package private) void
boolean
containsKey
(ActiveDescriptor<?> descriptor) TheContext
API for discovering if a descriptor has been createdvoid
destroyOne
(ActiveDescriptor<?> descriptor) TheContext
API.<U> U
findOrCreate
(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root) This is from theContext
API, called by the wrapper(package private) long
Gets the current task(package private) int
(package private) Executor
(package private) int
(package private) Integer
(package private) List
<ActiveDescriptor<?>> getOrderedListOfServicesAtLevel
(int level) (package private) RunLevelController.ThreadingPolicy
(package private) void
hardCancelOne
(ActiveDescriptor<?> descriptor) No need to lock this, it is called with the lock already held(package private) void
jobDone()
(package private) void
private static String
oneLineDescriptor
(ActiveDescriptor<?> descriptor) private static String
oneLineRoot
(ServiceHandle<?> root) proceedTo
(int level) This method is called to change the proceedTo level of the system(package private) void
setCancelTimeout
(long cancelTimeout) (package private) void
setCurrentLevel
(int currentLevel) (package private) void
setExecutor
(Executor executor) (package private) void
setMaximumThreads
(int maximum) (package private) void
setModeOverride
(Integer modeOverride) (package private) void
private void
validate
(ActiveDescriptor<?> descriptor, int currentLevel) Verifies that the run level value of theRunLevel
annotated service described by the given descriptor is valid for activation.(package private) boolean
wouldBlockRightNow
(ActiveDescriptor<?> desc)
-
Field Details
-
DEBUG_CONTEXT_PROPERTY
- See Also:
-
DEBUG_CONTEXT
private static final boolean DEBUG_CONTEXT -
logger
-
timer
-
THREAD_FACTORY
-
hk2Logger
-
currentLevel
private int currentLevel -
currentTask
-
DEFAULT_EXECUTOR
-
backingMap
The backing maps for this context. -
levelErrorMap
-
wasCancelled
private boolean wasCancelled -
creatingDescriptors
The set of services currently being created -
hardCancelledDescriptors
The set of descriptors that have been hard cancelled -
orderedCreationList
-
executor
-
locator
-
maxThreads
private int maxThreads -
policy
-
cancelTimeout
private long cancelTimeout -
modeOverride
-
-
Constructor Details
-
AsyncRunLevelContext
Constructor for the guy who does the work- Parameters:
locator
- The locator to use
-
-
Method Details
-
findOrCreate
This is from theContext
API, called by the wrapper- Parameters:
activeDescriptor
- the descriptor to createroot
- The root descriptor- Returns:
- The object created
-
containsKey
TheContext
API for discovering if a descriptor has been created- Parameters:
descriptor
- The descriptor to find- Returns:
- true if already created, false otherwise
-
wouldBlockRightNow
-
hardCancelOne
No need to lock this, it is called with the lock already held- Parameters:
descriptor
- the non-null descriptor to hard cancel
-
destroyOne
TheContext
API. Removes a descriptor from the set- Parameters:
descriptor
- The descriptor to destroy
-
validate
private void validate(ActiveDescriptor<?> descriptor, int currentLevel) throws IllegalStateException Verifies that the run level value of theRunLevel
annotated service described by the given descriptor is valid for activation. Valid means that the run level value is less than or equal to the current or planned run level of the givenRunLevelController
.- Parameters:
descriptor
- the descriptor of the service being activatedservice
- the run level service
-
getCurrentLevel
int getCurrentLevel() -
levelCancelled
void levelCancelled() -
setCurrentLevel
void setCurrentLevel(int currentLevel) -
setPolicy
-
setExecutor
-
getExecutor
Executor getExecutor() -
getPolicy
RunLevelController.ThreadingPolicy getPolicy() -
getOrderedListOfServicesAtLevel
-
proceedTo
This method is called to change the proceedTo level of the system- Parameters:
level
- The level to change to- Returns:
- A non-null RunLevelFuture that is the handle to give the caller
- Throws:
CurrentlyRunningException
- If there is already a running job
-
jobDone
void jobDone() -
getCurrentFuture
Gets the current task- Returns:
- The current task, may be null if there is no current task
-
setMaximumThreads
void setMaximumThreads(int maximum) -
getMaximumThreads
int getMaximumThreads() -
clearErrors
void clearErrors() -
setCancelTimeout
void setCancelTimeout(long cancelTimeout) -
getCancelTimeout
long getCancelTimeout() -
getModeOverride
Integer getModeOverride() -
setModeOverride
-
oneLineDescriptor
-
oneLineRoot
-