use of io.pravega.client.stream.Transaction.Status in project pravega by pravega.
the class EventStreamWriterImpl method getTxn.
@Override
public Transaction<Type> getTxn(UUID txId) {
StreamSegments segments = getAndHandleExceptions(controller.getCurrentSegments(stream.getScope(), stream.getStreamName()), RuntimeException::new);
Status status = getAndHandleExceptions(controller.checkTransactionStatus(stream, txId), RuntimeException::new);
if (status != Status.OPEN) {
return new TransactionImpl<>(txId, controller, stream);
}
Map<Segment, SegmentTransaction<Type>> transactions = new HashMap<>();
for (Segment s : segments.getSegments()) {
SegmentOutputStream out = outputStreamFactory.createOutputStreamForTransaction(s, txId, segmentSealedCallBack, config, segments.getDelegationToken());
SegmentTransactionImpl<Type> impl = new SegmentTransactionImpl<>(txId, out, serializer);
transactions.put(s, impl);
}
return new TransactionImpl<Type>(txId, transactions, segments, controller, stream, pinger);
}
Aggregations