public static String addressToString(final long address, final long timestamp) {
return String.format("JournalAddress %,d{%,d}", address, timestamp);
}
private Exchange getExchange(final int treeHandle, final long from, final long timestamp) throws PersistitException {
final TreeDescriptor td = _support.handleToTreeDescriptor(treeHandle);
if (td == null) {
throw new CorruptJournalException("Tree handle " + treeHandle + " is undefined at "
+ addressToString(from, timestamp));
}
Volume volumeRef = _support.handleToVolume(td.getVolumeHandle());
Volume volume;
if (volumeRef == null) {
throw new CorruptJournalException("Volume handle " + td.getVolumeHandle() + " is undefined at "
+ addressToString(from, timestamp));
}
if (volumeRef.isOpened()) {
volume = volumeRef;
} else {
volume = _support.getPersistit().getVolume(volumeRef.getName());
if (volume == null) {
throw new MissingVolumeException("No matching Volume found for journal reference " + volumeRef + " at "
+ addressToString(from, timestamp), volumeRef.getName());
}
}
volume.verifyId(volume.getId());
if (VolumeStructure.DIRECTORY_TREE_NAME.equals(td.getTreeName())) {
return volume.getStructure().directoryExchange();
} else {
return _support.getPersistit().getExchange(volume, td.getTreeName(), true);
}
}