<commit_before>package com.bluecatcode.common.base;

import com.google.common.util.concurrent.SimpleTimeLimiter;
import com.google.common.util.concurrent.TimeLimiter;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

import static com.bluecatcode.common.base.FunctionalInterfaces.callable;

public class Try {

    private <T> T tryWith(Callable<T> callable) {
        try {
            return callable.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void tryWith(Effect effect) {
        tryWith(callable(effect));
    }

    private void tryWith(long timeoutDuration, TimeUnit timeoutUnit, Effect effect) {
        tryWith(timeoutDuration, timeoutUnit, callable(effect));
    }

    private <T> T tryWith(long timeoutDuration, TimeUnit timeoutUnit, Callable<T> callable) {
        try {
            TimeLimiter limiter = new SimpleTimeLimiter();
            //noinspection unchecked
            Callable<T> proxy = limiter.newProxy(callable, Callable.class, timeoutDuration, timeoutUnit);
            return proxy.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}<commit_msg>Minor code tweaks<commit_after>package com.bluecatcode.common.base;

import com.google.common.util.concurrent.SimpleTimeLimiter;
import com.google.common.util.concurrent.TimeLimiter;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

import static com.bluecatcode.common.base.FunctionalInterfaces.callable;

public class Try {

    public <T> T tryWith(Callable<T> callable) {
        try {
            return callable.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public void tryWith(Effect effect) {
        tryWith(callable(effect));
    }

    public void tryWith(long timeoutDuration, TimeUnit timeoutUnit, Effect effect) {
        tryWith(timeoutDuration, timeoutUnit, callable(effect));
    }

    public <T> T tryWith(long timeoutDuration, TimeUnit timeoutUnit, Callable<T> callable) {
        try {
            TimeLimiter limiter = new SimpleTimeLimiter();
            //noinspection unchecked
            Callable<T> proxy = limiter.newProxy(callable, Callable.class, timeoutDuration, timeoutUnit);
            return proxy.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
{'fraction_non_alphanumeric': 0.09672131147540984, 'fraction_numerical': 0.0, 'mean_word_length': 2.8807631160572336, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6436561', 'n_tokens_mistral': 689, 'n_tokens_neox': 679, 'n_words': 154}