use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.
the class Files method makeTempDir.
public static File makeTempDir() {
File result;
try {
result = File.createTempFile("questdb", "");
deleteOrException(result);
mkDirsOrException(result);
} catch (Exception e) {
throw new JournalRuntimeException("Exception when creating temp dir", e);
}
return result;
}
use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.
the class JournalIterators method createRanges.
private static <T> ObjList<JournalIteratorRange> createRanges(Journal<T> journal) {
final int partitionCount = journal.getPartitionCount();
ObjList<JournalIteratorRange> ranges = new ObjList<>(partitionCount);
try {
for (int i = 0; i < partitionCount; i++) {
Partition<T> p = journal.getPartition(i, true);
long size = p.size();
if (size > 0) {
ranges.add(new JournalIteratorRange(p.getPartitionIndex(), 0, size - 1));
}
}
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
return ranges;
}
use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.
the class JournalIterators method incrementBufferedIterator.
public static <T> JournalPeekingIterator<T> incrementBufferedIterator(Journal<T> journal) {
try {
long lo = journal.getMaxRowID();
journal.refresh();
return new JournalBufferedIterator<>(journal, createRanges(journal, journal.incrementRowID(lo)));
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.
the class JournalIterators method incrementIterator.
public static <T> JournalPeekingIterator<T> incrementIterator(Journal<T> journal) {
try {
long lo = journal.getMaxRowID();
journal.refresh();
return new JournalIteratorImpl<>(journal, createRanges(journal, journal.incrementRowID(lo)));
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.
the class JournalWriter method close.
@Override
public final void close() {
if (open) {
if (closeInterceptor != null && !closeInterceptor.canClose(this)) {
return;
}
try {
if (isCommitOnClose()) {
commit();
}
if (partitionCleaner != null) {
purgeTempPartitions();
partitionCleaner.halt();
partitionCleaner = null;
}
super.close();
if (writeLock != null) {
LockManager.release(writeLock);
writeLock = null;
}
Misc.free(discardSink);
Misc.free(discardTxtRaf);
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
}
Aggregations