try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
boolean snapshotTaken = txManager.takeSnapshot(out);
if (!snapshotTaken) {
throw new TransactionCouldNotTakeSnapshotException("Transaction manager did not take a snapshot.");
}
} finally {
out.close();
}
return new ByteArrayInputStream(out.toByteArray());
} catch (IOException e) {
LOG.error("Snapshot could not be taken", e);
throw new TransactionCouldNotTakeSnapshotException(e.getMessage());
}
}