Class Synchronized<T>

java.lang.Object
com.landawn.abacus.util.Synchronized<T>
Type Parameters:
T -

public final class Synchronized<T> extends Object
Since:
0.8
Author:
Haiyang Li
  • Method Details

    • on

      public static <T> Synchronized<T> on(T mutex)
      Type Parameters:
      T -
      Parameters:
      mutex -
      Returns:
    • run

      public static <T, E extends Throwable> void run(T mutex, Throwables.Runnable<E> cmd) throws E
      Type Parameters:
      T -
      E -
      Parameters:
      mutex - to locked on.
      cmd -
      Throws:
      E - the e
    • call

      public static <T, R, E extends Throwable> R call(T mutex, Throwables.Callable<R,E> cmd) throws E
      Type Parameters:
      T -
      R -
      E -
      Parameters:
      mutex - to locked on.
      cmd -
      Returns:
      Throws:
      E - the e
    • test

      public static <T, E extends Throwable> boolean test(T mutex, Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      T -
      E -
      Parameters:
      mutex - to locked on.
      predicate -
      Returns:
      Throws:
      E - the e
    • test

      public static <T, U, E extends Throwable> boolean test(T mutex, U u, Throwables.BiPredicate<? super T,? super U,E> predicate) throws E
      Type Parameters:
      T -
      U -
      E -
      Parameters:
      mutex - to locked on.
      u -
      predicate -
      Returns:
      Throws:
      E - the e
    • accept

      public static <T, E extends Throwable> void accept(T mutex, Throwables.Consumer<? super T,E> consumer) throws E
      Type Parameters:
      T -
      E -
      Parameters:
      mutex - to locked on.
      consumer -
      Throws:
      E - the e
    • accept

      public static <T, U, E extends Throwable> void accept(T mutex, U u, Throwables.BiConsumer<? super T,? super U,E> consumer) throws E
      Type Parameters:
      T -
      U -
      E -
      Parameters:
      mutex - to locked on.
      u -
      consumer -
      Throws:
      E - the e
    • apply

      public static <T, R, E extends Throwable> R apply(T mutex, Throwables.Function<? super T,? extends R,E> funciton) throws E
      Type Parameters:
      T -
      R -
      E -
      Parameters:
      mutex - to locked on.
      funciton -
      Returns:
      Throws:
      E - the e
    • apply

      public static <T, U, R, E extends Throwable> R apply(T mutex, U u, Throwables.BiFunction<? super T,? super U,? extends R,E> funciton) throws E
      Type Parameters:
      T -
      U -
      R -
      E -
      Parameters:
      mutex - to locked on.
      u -
      funciton -
      Returns:
      Throws:
      E - the e
    • run

      public <E extends Throwable> void run(Throwables.Runnable<E> cmd) throws E
      Type Parameters:
      E -
      Parameters:
      cmd -
      Throws:
      E - the e
    • call

      public <R, E extends Throwable> R call(Throwables.Callable<R,E> cmd) throws E
      Type Parameters:
      R -
      E -
      Parameters:
      cmd -
      Returns:
      Throws:
      E - the e
    • test

      public <E extends Throwable> boolean test(Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E - the e
    • accept

      public <E extends Throwable> void accept(Throwables.Consumer<? super T,E> consumer) throws E
      Type Parameters:
      E -
      Parameters:
      consumer -
      Throws:
      E - the e
    • apply

      public <R, E extends Throwable> R apply(Throwables.Function<? super T,? extends R,E> function) throws E
      Type Parameters:
      R -
      E -
      Parameters:
      function -
      Returns:
      Throws:
      E - the e