@Override public CompletableFuture<Void> rollbackAndEndTransaction() { Completable<Void> ret = new Completable<>(); rollbackAndClose().thenAccept(c -> { inTransaction.set(false); ret.succeeded(null); }).exceptionally(e -> { inTransaction.set(false); ret.failed(e); return null; }); return ret; }
@Override public CompletableFuture<Void> rollbackAndEndTransaction() { Completable<Void> ret = new Completable<>(); rollbackAndClose().thenAccept(c -> { inTransaction.set(false); ret.succeeded(null); }).exceptionally(e -> { inTransaction.set(false); ret.failed(e); return null; }); return ret; }
@Override public CompletableFuture<Void> commitAndEndTransaction() { Completable<Void> ret = new Completable<>(); commitAndClose().thenAccept(c -> { inTransaction.set(false); ret.succeeded(null); }).exceptionally(e -> { inTransaction.set(false); ret.failed(e); return null; }); return ret; }
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
@Override public CompletableFuture<Void> commitAndEndTransaction() { Completable<Void> ret = new Completable<>(); commitAndClose().thenAccept(c -> { inTransaction.set(false); ret.succeeded(null); }).exceptionally(e -> { inTransaction.set(false); ret.failed(e); return null; }); return ret; }
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
public void failed(Throwable x) { c.failed(x); } });
private void checkObjectFromPool(PooledObject<T> pooledObject, Promise.Completable<PooledObject<T>> completable) { if (pooledObject.prepareTake()) { if (validator.isValid(pooledObject)) { pooledObject.setPhantomReference(getLeakDetector().register(pooledObject, pooledObject.getLeakCallback())); completable.succeeded(pooledObject); } else { destroyObject(pooledObject); createObject(completable); } } else { completable.failed(new CommonRuntimeException("the pooled object has been used")); } }
public <T> Promise.Completable<T> asyncTransaction(Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(executeTransaction(func)); } catch (Throwable t) { c.failed(t); } }); return c; }
public Promise.Completable<Connection> asyncGetConnection() { Promise.Completable<Connection> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(getConnection()); } catch (Throwable t) { c.failed(t); } }); return c; }
private void checkObjectFromPool(PooledObject<T> pooledObject, Promise.Completable<PooledObject<T>> completable) { if (pooledObject.prepareTake()) { if (validator.isValid(pooledObject)) { pooledObject.setPhantomReference(getLeakDetector().register(pooledObject, pooledObject.getLeakCallback())); completable.succeeded(pooledObject); } else { destroyObject(pooledObject); createObject(completable); } } else { completable.failed(new CommonRuntimeException("the pooled object has been used")); } }
public <T> Promise.Completable<T> asyncTransaction(Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(executeTransaction(func)); } catch (Throwable t) { c.failed(t); } }); return c; }
public <T> Promise.Completable<T> async(Connection connection, Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(func.call(connection, this)); } catch (Throwable t) { c.failed(t); } }); return c; }
public Promise.Completable<Connection> asyncGetConnection() { Promise.Completable<Connection> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(getConnection()); } catch (Throwable t) { c.failed(t); } }); return c; }
public <T> Promise.Completable<T> async(Connection connection, Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(func.call(connection, this)); } catch (Throwable t) { c.failed(t); } }); return c; }