private void throwIfClosed() throws TxnFailedException { if (closed.get()) { throw new TxnFailedException(); } }
private void throwIfClosed() throws TxnFailedException { if (closed.get()) { throw new TxnFailedException(); } } }
private void checkFailed() throws TxnFailedException { Throwable cause = txnFailedCause.get(); if (cause != null) { throw new TxnFailedException(cause); } }
@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); } }