Package io.sentry

Class SentryWrapper

java.lang.Object
io.sentry.SentryWrapper

public final class SentryWrapper extends Object
Helper class that provides wrappers around: that clones the Hub before execution and restores it afterwards. This prevents reused threads (e.g. from thread-pools) from getting an incorrect state.
  • Constructor Details

    • SentryWrapper

      public SentryWrapper()
  • Method Details

    • wrapCallable

      public static <U> Callable<U> wrapCallable(@NotNull @NotNull Callable<U> callable)
      Helper method to wrap Callable

      Clones the Hub before execution and restores it afterwards. This prevents reused threads (e.g. from thread-pools) from getting an incorrect state.

      Type Parameters:
      U - - the result type of the Callable
      Parameters:
      callable - - the Callable to be wrapped
      Returns:
      the wrapped Callable
    • wrapSupplier

      public static <U> Supplier<U> wrapSupplier(@NotNull @NotNull Supplier<U> supplier)
      Helper method to wrap Supplier

      Clones the Hub before execution and restores it afterwards. This prevents reused threads (e.g. from thread-pools) from getting an incorrect state.

      Type Parameters:
      U - - the result type of the Supplier
      Parameters:
      supplier - - the Supplier to be wrapped
      Returns:
      the wrapped Supplier