private void checkFailed() throws TxnFailedException { Throwable cause = txnFailedCause.get(); if (cause != null) { throw new TxnFailedException(cause); } }
@Override public void abort() { if (!closed.get()) { for (SegmentTransaction<Type> tx : inner.values()) { try { tx.close(); } catch (TxnFailedException e) { log.debug("Got exception while writing to transaction on abort: {}", e.getMessage()); } } pinger.stopPing(txId); getAndHandleExceptions(controller.abortTransaction(stream, txId), RuntimeException::new); closed.set(true); } }
@Override public void abort() { if (!closed.get()) { pinger.stopPing(txId); for (SegmentTransaction<Type> tx : inner.values()) { try { tx.close(); } catch (TxnFailedException e) { log.debug("Got exception while writing to transaction on abort: {}", e.getMessage()); } } getAndHandleExceptions(controller.abortTransaction(stream, txId), RuntimeException::new); closed.set(true); } }
private void throwIfClosed() throws TxnFailedException { if (closed.get()) { throw new TxnFailedException(); } }
private void throwIfClosed() throws TxnFailedException { if (closed.get()) { throw new TxnFailedException(); } } }
@Override public void segmentDeleted(WireCommands.SegmentDeleted segmentDeleted) { result.completeExceptionally(new TxnFailedException("Transaction already aborted.")); }
@Override public void segmentsMerged(WireCommands.SegmentsMerged segmentsMerged) { result.completeExceptionally(new TxnFailedException("Transaction already committed.")); }
@Override public void close() throws TxnFailedException { flush(); try { out.close(); } catch (SegmentSealedException e) { throw new TxnFailedException(e); } }
@Override public void flush() throws TxnFailedException { checkFailed(); try { out.flush(); synchronized (lock) { removeCompleted(); checkFailed(); } } catch (SegmentSealedException e) { throw new TxnFailedException(e); } }