Package arez

Class Zone

java.lang.Object
arez.Zone

@OmitType(unless="arez.enable_zones") public final class Zone extends Object
An isolated Arez context.
  • Method Details

    • getContext

      @Nonnull public ArezContext getContext()
      Return the context for the zone.
      Returns:
      the context for the zone.
    • isActive

      public boolean isActive()
    • safeRun

      public <T> T safeRun(@Nonnull SafeFunction<T> action)
      Run the specified function in the zone. Activate the zone on entry, deactivate on exit.
      Type Parameters:
      T - The type of the value returned from function.
      Parameters:
      action - the function to execute.
      Returns:
      the value returned from function.
    • run

      public <T> T run(@Nonnull Function<T> action) throws Throwable
      Run the specified function in the zone. Activate the zone on entry, deactivate on exit.
      Type Parameters:
      T - The type of the value returned from function.
      Parameters:
      action - the function to execute.
      Returns:
      the value returned from function.
      Throws:
      Throwable - if the function throws an exception.
    • safeRun

      public void safeRun(@Nonnull SafeProcedure action)
      Run the specified procedure in the zone. Activate the zone on entry, deactivate on exit.
      Parameters:
      action - the procedure to execute.
    • run

      public void run(@Nonnull Procedure action) throws Throwable
      Run the specified procedure in the zone. Activate the zone on entry, deactivate on exit.
      Parameters:
      action - the procedure to execute.
      Throws:
      Throwable - if the procedure throws an exception.