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

com.github.panhongan.commons.ExceptionalActionWrapper Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package com.github.panhongan.commons;

import java.util.concurrent.Callable;

/**
 * @author panhongan
 * @since 2020.9.10
 * @version 1.0
 */

public class ExceptionalActionWrapper {

    public static  T run(Callable callable) {
        try {
            return callable.call();
        } catch (MysqlConveyerException e) {
            throw e;
        } catch (Exception e) {
            throw new MysqlConveyerException(e);
        }
    }

    public static void run(Runnable runnable) {
        Callable callable = () -> {
            runnable.run();
            return null;
        };

        run(callable);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy