com.vaadin.signals.impl.
Class UsageTracker
Tracks signal value read operations while a task is run.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Tracks the state of some used value.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UsageTracker.Usage
A usage that doesn't have any changes and never fires any events.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isActive()
Checks whether a usage tracker is currently active.
static void
registerUsage
(UsageTracker.Usage usage) Registers a usage with the current usage tracker.
static UsageTracker.Usage
Runs the given task while tracking all cases where a managed value is used.
static <T> T
Runs the given supplier without tracking usage even if a usage tracker is active.
-
Field Details
-
NO_USAGE
A usage that doesn't have any changes and never fires any events.
-
-
Method Details
-
track
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, notnull
Returns:
a usage instance that combines all used managed values, not
null
-
untracked
Runs the given supplier without tracking usage even if a usage tracker is active.
Type Parameters:
T
- the supplier typeParameters:
task
- the supplier task to run, notnull
Returns:
the value returned from the supplier
-
registerUsage
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, notnull
-
isActive
public static boolean isActive()Checks whether a usage tracker is currently active.
Returns:
true
if a usage tracker is active
-