Class ThreadStateValidator

java.lang.Object
com.sun.corba.ee.spi.threadpool.ThreadStateValidator

public class ThreadStateValidator extends Object
Interface to support thread state validation. The basic idea is that one or more validators can be registered with an implementation of the TSV. The validators are executed whenever a thread is returned to the threadpool, For example, a validator may check for unreleased locks or uncleared threadlocals. This is intended as a last-ditch backstop for leaking resource problems.
  • Field Details

    • wrapper

      private static final Exceptions wrapper
    • validators

      private static final List<Runnable> validators
  • Constructor Details

    • ThreadStateValidator

      private ThreadStateValidator()
  • Method Details

    • registerValidator

      public static void registerValidator(Runnable validator)
      Register a thread validator (represented as a Runnable). A validator may check for locks that should not be held, check for threadlocals that should be cleared, or take any other action to check for resources that should not be held once the thread is no longer needed, as signaled by the thread being returned to the threadpool.

      A validator typically may take the following actions:

      1. Check whether or not a resource has been released.
      2. Log any detected problems.
      3. Reclaim the resource.
      A validator should NOT throw an exception, as all exceptions thrown from a validator will be ignored.
      Parameters:
      validator -
    • checkValidators

      public static void checkValidators()
      Execute all of the validators. Should only be called from the threadpool implementation.