Class StandardVirtualThreadExecutor

All Implemented Interfaces:
Executor, MBeanRegistration, Executor, JmxEnabled, Lifecycle

public class StandardVirtualThreadExecutor extends LifecycleMBeanBase implements Executor
An executor that uses a new virtual thread for each task.
  • Constructor Details

    • StandardVirtualThreadExecutor

      public StandardVirtualThreadExecutor()
  • Method Details

    • setName

      public void setName(String name)
    • getName

      public String getName()
      Specified by:
      getName in interface Executor
    • getNamePrefix

      public String getNamePrefix()
    • setNamePrefix

      public void setNamePrefix(String namePrefix)
    • execute

      public void execute(Runnable command)
      Specified by:
      execute in interface Executor
    • execute

      public void execute(Runnable command, long timeout, TimeUnit unit)
      Description copied from interface: Executor
      Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation. If no threads are available, it will be added to the work queue. If the work queue is full, the system will wait for the specified time until it throws a RejectedExecutionException
      Specified by:
      execute in interface Executor
      Parameters:
      command - the runnable task
      timeout - the length of time to wait for the task to complete
      unit - the units in which timeout is expressed
    • initInternal

      protected void initInternal() throws LifecycleException
      Description copied from class: LifecycleMBeanBase
      Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.
      Overrides:
      initInternal in class LifecycleMBeanBase
      Throws:
      LifecycleException - If the initialisation fails
    • startInternal

      protected void startInternal() throws LifecycleException
      Description copied from class: LifecycleBase
      Sub-classes must ensure that the state is changed to LifecycleState.STARTING during the execution of this method. Changing state will trigger the Lifecycle.START_EVENT event. If a component fails to start it may either throw a LifecycleException which will cause it's parent to fail to start or it can place itself in the error state in which case LifecycleBase.stop() will be called on the failed component but the parent component will continue to start normally.
      Specified by:
      startInternal in class LifecycleBase
      Throws:
      LifecycleException - Start error occurred
    • stopInternal

      protected void stopInternal() throws LifecycleException
      Description copied from class: LifecycleBase
      Sub-classes must ensure that the state is changed to LifecycleState.STOPPING during the execution of this method. Changing state will trigger the Lifecycle.STOP_EVENT event.
      Specified by:
      stopInternal in class LifecycleBase
      Throws:
      LifecycleException - Stop error occurred
    • getDomainInternal

      protected String getDomainInternal()
      Description copied from class: LifecycleMBeanBase
      Method implemented by sub-classes to identify the domain in which MBeans should be registered.
      Specified by:
      getDomainInternal in class LifecycleMBeanBase
      Returns:
      The name of the domain to use to register MBeans.
    • getObjectNameKeyProperties

      protected String getObjectNameKeyProperties()
      Description copied from class: LifecycleMBeanBase
      Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.
      Specified by:
      getObjectNameKeyProperties in class LifecycleMBeanBase
      Returns:
      The string representation of the key properties component of the desired ObjectName