Class AsyncRunLevelContext
java.lang.Object
org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<ActiveDescriptor<?>, Object> The backing maps for this context.private longprivate final HashMap<ActiveDescriptor<?>, Long> The set of services currently being createdprivate intprivate CurrentTaskFutureWrapperprivate static final booleanprivate static final Stringprivate static final Executorprivate Executorprivate final HashSet<ActiveDescriptor<?>> The set of descriptors that have been hard cancelledprivate final Loggerprivate final Map<ActiveDescriptor<?>, Throwable> private final ServiceLocatorprivate static final Loggerprivate intprivate Integerprivate final LinkedList<ActiveDescriptor<?>> private static final ThreadFactoryprivate static final Timerprivate boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAsyncRunLevelContext(ServiceLocator locator) Constructor for the guy who does the work -
Method Summary
Modifier and TypeMethodDescription(package private) voidbooleancontainsKey(ActiveDescriptor<?> descriptor) TheContextAPI for discovering if a descriptor has been createdvoiddestroyOne(ActiveDescriptor<?> descriptor) TheContextAPI.<U> UfindOrCreate(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root) This is from theContextAPI, called by the wrapper(package private) longGets 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) voidhardCancelOne(ActiveDescriptor<?> descriptor) No need to lock this, it is called with the lock already held(package private) voidjobDone()(package private) voidprivate static StringoneLineDescriptor(ActiveDescriptor<?> descriptor) private static StringoneLineRoot(ServiceHandle<?> root) proceedTo(int level) This method is called to change the proceedTo level of the system(package private) voidsetCancelTimeout(long cancelTimeout) (package private) voidsetCurrentLevel(int currentLevel) (package private) voidsetExecutor(Executor executor) (package private) voidsetMaximumThreads(int maximum) (package private) voidsetModeOverride(Integer modeOverride) (package private) voidprivate voidvalidate(ActiveDescriptor<?> descriptor, int currentLevel) Verifies that the run level value of theRunLevelannotated service described by the given descriptor is valid for activation.(package private) booleanwouldBlockRightNow(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 theContextAPI, called by the wrapper- Parameters:
activeDescriptor- the descriptor to createroot- The root descriptor- Returns:
- The object created
-
containsKey
TheContextAPI 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
TheContextAPI. 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 theRunLevelannotated 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
-