Top Description Fields Constructors Methods
org.glassfish.hk2.runlevel.internal

public Class RunLevelControllerImpl

extends Object
implements RunLevelController
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.runlevel.RunLevelController
Annotations
@Service
@ContractsProvided:RunLevelController
@Visibility:LOCAL
Imports
java.util.concurrent.ExecutionException, .Executor, jakarta.inject.Inject, org.glassfish.hk2.api.DescriptorVisibility, .MultiException, .Visibility, org.glassfish.hk2.runlevel.CurrentlyRunningException, .RunLevel, .RunLevelController, .RunLevelFuture, org.jvnet.hk2.annotations.ContractsProvided, .Service

This is the implementation of the RunLevelController
Author
jwells

Field Summary

Modifier and TypeField and Description
private AsyncRunLevelContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Implements org.glassfish.hk2.runlevel.RunLevelController.cancel.

If there is a current procedure in process this method will get it and cancel it

public long
getCancelTimeoutMilliseconds()

Implements org.glassfish.hk2.runlevel.RunLevelController.getCancelTimeoutMilliseconds.

Returns the amount of time in milliseconds the run level service will wait after a cancel call before orphaning services that have not yet completed execution

public RunLevelFuture
getCurrentProceeding()

Implements org.glassfish.hk2.runlevel.RunLevelController.getCurrentProceeding.

This method will return the current proceedTo that the RunLevelController is working on, or it will return null if the controller is not currently moving up or down

public int
public Executor
getExecutor()

Implements org.glassfish.hk2.runlevel.RunLevelController.getExecutor.

Gets the executor that will be used by the system when executing tasks.

public int
getMaximumUseableThreads()

Implements org.glassfish.hk2.runlevel.RunLevelController.getMaximumUseableThreads.

Returns the current number of maximum useable threads

public RunLevelController.ThreadingPolicy
getThreadingPolicy()

Implements org.glassfish.hk2.runlevel.RunLevelController.getThreadingPolicy.

Returns the threading policy currently being used by this controller

public Integer
getValidationOverride()

Implements org.glassfish.hk2.runlevel.RunLevelController.getValidationOverride.

Returns the override value for the RunLevel#mode() field in RunLevel services.

public void
proceedTo(int runLevel)

Implements org.glassfish.hk2.runlevel.RunLevelController.proceedTo.

This method will move to the given run level synchronously as per RunLevelController#proceedToAsync(int).

public RunLevelFuture
proceedToAsync(int runLevel)

Implements org.glassfish.hk2.runlevel.RunLevelController.proceedToAsync.

Causes this RunLevelController to move to the specified run level for all RunLevel instances, orchestrating the appropriate lifecycle events.

public void
setCancelTimeoutMilliseconds(long cancelTimeout)

Implements org.glassfish.hk2.runlevel.RunLevelController.setCancelTimeoutMilliseconds.

Sets the amount of time in milliseconds the run level service will wait after a cancel call before orphaning services that have not yet completed execution

The default value is 5000 (5 seconds).

public void
setExecutor(Executor executor)

Implements org.glassfish.hk2.runlevel.RunLevelController.setExecutor.

Sets the executor to use for the next job.

public void
setMaximumUseableThreads(int maximumThreads)

Implements org.glassfish.hk2.runlevel.RunLevelController.setMaximumUseableThreads.

This sets the maximum number of threads that the system can create for creation and/or destruction of threads.

public void
setThreadingPolicy(RunLevelController.ThreadingPolicy policy)

Implements org.glassfish.hk2.runlevel.RunLevelController.setThreadingPolicy.

Sets the threading policy that will be used by this controller.

public void
setValidationOverride(Integer validationMode)

Implements org.glassfish.hk2.runlevel.RunLevelController.setValidationOverride.

Sets the override value for the RunLevel#mode() field in RunLevel services.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private AsyncRunLevelContext context
Annotations
@Inject

Constructor Detail

RunLevelControllerImplback to summary
public RunLevelControllerImpl()

Method Detail

cancelback to summary
public void cancel()

Implements org.glassfish.hk2.runlevel.RunLevelController.cancel.

Doc from org.glassfish.hk2.runlevel.RunLevelController.cancel.

If there is a current procedure in process this method will get it and cancel it

Annotations
@Override
getCancelTimeoutMillisecondsback to summary
public long getCancelTimeoutMilliseconds()

Implements org.glassfish.hk2.runlevel.RunLevelController.getCancelTimeoutMilliseconds.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getCancelTimeoutMilliseconds.

Returns the amount of time in milliseconds the run level service will wait after a cancel call before orphaning services that have not yet completed execution

Annotations
@Override
getCurrentProceedingback to summary
public RunLevelFuture getCurrentProceeding()

Implements org.glassfish.hk2.runlevel.RunLevelController.getCurrentProceeding.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getCurrentProceeding.

This method will return the current proceedTo that the RunLevelController is working on, or it will return null if the controller is not currently moving up or down

Annotations
@Override
getCurrentRunLevelback to summary
public int getCurrentRunLevel()

Implements org.glassfish.hk2.runlevel.RunLevelController.getCurrentRunLevel.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getCurrentRunLevel.

The current run level state. This represents the last run level successfully achieved by the underlying RunLevelController responsible for this scope.

Annotations
@Override
getExecutorback to summary
public Executor getExecutor()

Implements org.glassfish.hk2.runlevel.RunLevelController.getExecutor.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getExecutor.

Gets the executor that will be used by the system when executing tasks. This value will be used even if the policy is USE_NO_THREADS in order to support canceling hung threads

Annotations
@Override
getMaximumUseableThreadsback to summary
public int getMaximumUseableThreads()

Implements org.glassfish.hk2.runlevel.RunLevelController.getMaximumUseableThreads.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getMaximumUseableThreads.

Returns the current number of maximum useable threads

Annotations
@Override
getThreadingPolicyback to summary
public RunLevelController.ThreadingPolicy getThreadingPolicy()

Implements org.glassfish.hk2.runlevel.RunLevelController.getThreadingPolicy.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getThreadingPolicy.

Returns the threading policy currently being used by this controller

Annotations
@Override
getValidationOverrideback to summary
public Integer getValidationOverride()

Implements org.glassfish.hk2.runlevel.RunLevelController.getValidationOverride.

Doc from org.glassfish.hk2.runlevel.RunLevelController.getValidationOverride.

Returns the override value for the RunLevel#mode() field in RunLevel services. If this value is non-null then the mode will be forced to this value. This is useful in testing scenarios where the test would like to instantiate a run-level service without having to instantiate all the others at a certain level

Annotations
@Override
proceedToback to summary
public void proceedTo(int runLevel)

Implements org.glassfish.hk2.runlevel.RunLevelController.proceedTo.

Doc from org.glassfish.hk2.runlevel.RunLevelController.proceedTo.

This method will move to the given run level synchronously as per RunLevelController#proceedToAsync(int).

Annotations
@Override
proceedToAsyncback to summary
public RunLevelFuture proceedToAsync(int runLevel) throws CurrentlyRunningException, IllegalStateException

Implements org.glassfish.hk2.runlevel.RunLevelController.proceedToAsync.

Doc from org.glassfish.hk2.runlevel.RunLevelController.proceedToAsync.

Causes this RunLevelController to move to the specified run level for all RunLevel instances, orchestrating the appropriate lifecycle events.

If the run level specified is the same as the current run level then the RunLevelController may return immediately

Annotations
@Override
Exceptions
CurrentlyRunningException:
if there is currently a job running this exception will be thrown with the currently running job
IllegalStateException:
if this method is called when the USE_NO_THREADS policy is in effect
setCancelTimeoutMillisecondsback to summary
public void setCancelTimeoutMilliseconds(long cancelTimeout)

Implements org.glassfish.hk2.runlevel.RunLevelController.setCancelTimeoutMilliseconds.

Doc from org.glassfish.hk2.runlevel.RunLevelController.setCancelTimeoutMilliseconds.

Sets the amount of time in milliseconds the run level service will wait after a cancel call before orphaning services that have not yet completed execution

The default value is 5000 (5 seconds). In general this value should be set to be longer than than the running time of the longest service that may be cancelled

Annotations
@Override
setExecutorback to summary
public void setExecutor(Executor executor)

Implements org.glassfish.hk2.runlevel.RunLevelController.setExecutor.

Doc from org.glassfish.hk2.runlevel.RunLevelController.setExecutor.

Sets the executor to use for the next job. This value will be used even if the policy is USE_NO_THREADS in order to support canceling hung threads

Annotations
@Override
setMaximumUseableThreadsback to summary
public void setMaximumUseableThreads(int maximumThreads)

Implements org.glassfish.hk2.runlevel.RunLevelController.setMaximumUseableThreads.

Doc from org.glassfish.hk2.runlevel.RunLevelController.setMaximumUseableThreads.

This sets the maximum number of threads that the system can create for creation and/or destruction of threads. This number must be one or greater

Annotations
@Override
setThreadingPolicyback to summary
public void setThreadingPolicy(RunLevelController.ThreadingPolicy policy)

Implements org.glassfish.hk2.runlevel.RunLevelController.setThreadingPolicy.

Doc from org.glassfish.hk2.runlevel.RunLevelController.setThreadingPolicy.

Sets the threading policy that will be used by this controller. The values can be:

  1. FULLY_THREADED: Use maximumUseableThreads to complete any task
  2. USE_NO_THREADS: Never create a thread, use the callers thread always
Annotations
@Override
setValidationOverrideback to summary
public void setValidationOverride(Integer validationMode)

Implements org.glassfish.hk2.runlevel.RunLevelController.setValidationOverride.

Doc from org.glassfish.hk2.runlevel.RunLevelController.setValidationOverride.

Sets the override value for the RunLevel#mode() field in RunLevel services. If this value is non-null then the mode will be forced to this value. This is useful in testing scenarios where the test would like to instantiate a run-level service without having to instantiate all the others at a certain level

Annotations
@Override