// 
// Decompiled by Procyon v0.6.0
// 

package io.sentry;

import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Callable;

public final class SentryWrapper
{
    public static <U> Callable<U> wrapCallable(@NotNull final Callable<U> callable) {
        final IScopes newScopes = Sentry.getCurrentScopes().forkedScopes("SentryWrapper.wrapCallable");
        return (Callable<U>)(() -> {
            try (final ISentryLifecycleToken ignored = newScopes.makeCurrent()) {
                callable.call();
                return;
            }
        });
    }
    
    public static <U> Supplier<U> wrapSupplier(@NotNull final Supplier<U> supplier) {
        final IScopes newScopes = Sentry.forkedScopes("SentryWrapper.wrapSupplier");
        return (Supplier<U>)(() -> {
            try (final ISentryLifecycleToken ignore = newScopes.makeCurrent()) {
                supplier.get();
                return;
            }
        });
    }
    
    public static Runnable wrapRunnable(@NotNull final Runnable runnable) {
        final IScopes newScopes = Sentry.forkedScopes("SentryWrapper.wrapRunnable");
        return () -> {
            try (final ISentryLifecycleToken ignore = newScopes.makeCurrent()) {
                runnable.run();
            }
        };
    }
}
