Class CurrentTaskFuture.QueueRunner
- java.lang.Object
-
- org.glassfish.hk2.runlevel.internal.CurrentTaskFuture.QueueRunner
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- CurrentTaskFuture
private static class CurrentTaskFuture.QueueRunner extends java.lang.Object implements java.lang.Runnable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashSet<ActiveDescriptor<?>>alreadyTriedprivate AsyncRunLevelContextasyncContextprivate ServiceLocatorlocatorprivate intmaxThreadsprivate CurrentTaskFuture.UpOneLevelparentprivate java.lang.ObjectparentLockprivate java.util.List<ServiceHandle<?>>queueprivate java.lang.ObjectqueueLockprivate ServiceHandle<?>wouldHaveBlocked
-
Constructor Summary
Constructors Modifier Constructor Description privateQueueRunner(ServiceLocator locator, AsyncRunLevelContext asyncContext, java.lang.Object queueLock, java.util.List<ServiceHandle<?>> queue, CurrentTaskFuture.UpOneLevel parent, java.lang.Object parentLock, int maxThreads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanisWouldBlockRightNow(java.util.HashSet<ActiveDescriptor<?>> cycleChecker, ActiveDescriptor<?> checkMe)This method does a preliminary check of whether or not the descriptor (or any children) would cause the thread to block.private voidoneJob(ServiceHandle<?> fService, boolean block)voidrun()
-
-
-
Field Detail
-
locator
private final ServiceLocator locator
-
asyncContext
private final AsyncRunLevelContext asyncContext
-
queueLock
private final java.lang.Object queueLock
-
queue
private final java.util.List<ServiceHandle<?>> queue
-
parent
private final CurrentTaskFuture.UpOneLevel parent
-
parentLock
private final java.lang.Object parentLock
-
maxThreads
private final int maxThreads
-
wouldHaveBlocked
private ServiceHandle<?> wouldHaveBlocked
-
alreadyTried
private final java.util.HashSet<ActiveDescriptor<?>> alreadyTried
-
-
Constructor Detail
-
QueueRunner
private QueueRunner(ServiceLocator locator, AsyncRunLevelContext asyncContext, java.lang.Object queueLock, java.util.List<ServiceHandle<?>> queue, CurrentTaskFuture.UpOneLevel parent, java.lang.Object parentLock, int maxThreads)
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
isWouldBlockRightNow
private boolean isWouldBlockRightNow(java.util.HashSet<ActiveDescriptor<?>> cycleChecker, ActiveDescriptor<?> checkMe)
This method does a preliminary check of whether or not the descriptor (or any children) would cause the thread to block. If this method returns true then we do not try this service, which can save on going down the getService stack and on the throwing and creation of WouldBlockException- Parameters:
cycleChecker- To ensure we are not caught in a cyclecheckMe- The descriptor to check- Returns:
- false if as far as we know this descriptor would NOT block, true if we think if we tried this descriptor right now that it would block
-
oneJob
private void oneJob(ServiceHandle<?> fService, boolean block)
-
-