com.vaadin.signals.impl.

Class UsageTracker

java.lang.Object
com.vaadin.signals.impl.UsageTracker
public class UsageTracker extends Object

Tracks signal value read operations while a task is run.

  • Field Details

    • NO_USAGE

      public static final UsageTracker.Usage NO_USAGE

      A usage that doesn't have any changes and never fires any events.

  • Method Details

    • track

      public static UsageTracker.Usage track(Runnable task)

      Runs the given task while tracking all cases where a managed value is used. The task is run in a read-only transaction.

      Parameters:

      task - the task to run, not null

      Returns:

      a usage instance that combines all used managed values, not null

    • untracked

      public static <T> T untracked(Supplier<T> task)

      Runs the given supplier without tracking usage even if a usage tracker is active.

      Type Parameters:

      T - the supplier type

      Parameters:

      task - the supplier task to run, not null

      Returns:

      the value returned from the supplier

    • registerUsage

      public static void registerUsage(UsageTracker.Usage usage)

      Registers a usage with the current usage tracker. This method should be run only if usage tracking is active.

      Parameters:

      usage - the usage instance to register, not null

    • isActive

      public static boolean isActive()

      Checks whether a usage tracker is currently active.

      Returns:

      true if a usage tracker is active