All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.valkyriercp.util.CachedCallable Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package org.valkyriercp.util;

import java.util.concurrent.Callable;

public abstract class CachedCallable implements Callable {
    private T cached;

    public T call() throws Exception {
        if(cached == null)
            cached = doCall();
        return cached;
    }

    public T safeCall() {
        try {
            return call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    protected abstract T doCall();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy