co.paralleluniverse.fibers.jdbc.JDBCFiberAsync Maven / Gradle / Ivy
The newest version!
/*
* COMSAT
* Copyright (c) 2015, Parallel Universe Software Co. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 3.0
* as published by the Free Software Foundation.
*/
package co.paralleluniverse.fibers.jdbc;
import co.paralleluniverse.common.util.CheckedCallable;
import co.paralleluniverse.fibers.FiberAsync;
import co.paralleluniverse.fibers.SuspendExecution;
import co.paralleluniverse.fibers.Suspendable;
import java.util.concurrent.ExecutorService;
/**
* @author circlespainter
*/
public abstract class JDBCFiberAsync extends FiberAsync {
@Suspendable
public static V exec(ExecutorService es, CheckedCallable cc) throws E {
try {
return runBlocking(es, cc);
} catch (final SuspendExecution se) {
throw new AssertionError(se);
} catch (final InterruptedException ie) {
throw new RuntimeException(ie);
}
}
}