Class AsyncRunLevelContext

java.lang.Object
org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext

@Service @Visibility(LOCAL) public class AsyncRunLevelContext extends Object
  • Field Details

  • Constructor Details

    • AsyncRunLevelContext

      @Inject private AsyncRunLevelContext(ServiceLocator locator)
      Constructor for the guy who does the work
      Parameters:
      locator - The locator to use
  • Method Details

    • findOrCreate

      public <U> U findOrCreate(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root)
      This is from the Context API, called by the wrapper
      Parameters:
      activeDescriptor - the descriptor to create
      root - The root descriptor
      Returns:
      The object created
    • containsKey

      public boolean containsKey(ActiveDescriptor<?> descriptor)
      The Context API for discovering if a descriptor has been created
      Parameters:
      descriptor - The descriptor to find
      Returns:
      true if already created, false otherwise
    • wouldBlockRightNow

      boolean wouldBlockRightNow(ActiveDescriptor<?> desc)
    • hardCancelOne

      void hardCancelOne(ActiveDescriptor<?> descriptor)
      No need to lock this, it is called with the lock already held
      Parameters:
      descriptor - the non-null descriptor to hard cancel
    • destroyOne

      public void destroyOne(ActiveDescriptor<?> descriptor)
      The Context 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 the RunLevel 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 given RunLevelController.
      Parameters:
      descriptor - the descriptor of the service being activated
      service - the run level service
    • getCurrentLevel

      int getCurrentLevel()
    • levelCancelled

      void levelCancelled()
    • setCurrentLevel

      void setCurrentLevel(int currentLevel)
    • setPolicy

      void setPolicy(RunLevelController.ThreadingPolicy policy)
    • setExecutor

      void setExecutor(Executor executor)
    • getExecutor

      Executor getExecutor()
    • getPolicy

    • getOrderedListOfServicesAtLevel

      List<ActiveDescriptor<?>> getOrderedListOfServicesAtLevel(int level)
    • proceedTo

      public RunLevelFuture proceedTo(int level) throws CurrentlyRunningException
      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

      public RunLevelFuture 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

      void setModeOverride(Integer modeOverride)
    • oneLineDescriptor

      private static String oneLineDescriptor(ActiveDescriptor<?> descriptor)
    • oneLineRoot

      private static String oneLineRoot(ServiceHandle<?> root)