use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecord in project activemq-artemis by apache.
the class JournalImpl method appendDeleteRecord.
@Override
public void appendDeleteRecord(final long id, final boolean sync, final IOCompletion callback) throws Exception {
if (logger.isTraceEnabled()) {
logger.trace("scheduling appendDeleteRecord::id=" + id);
}
checkJournalIsLoaded();
lineUpContext(callback);
checkKnownRecordID(id);
final SimpleFuture<Boolean> result = newSyncAndCallbackResult(sync, callback);
appendExecutor.execute(new Runnable() {
@Override
public void run() {
journalLock.readLock().lock();
try {
JournalRecord record = null;
if (compactor == null) {
record = records.remove(id);
}
JournalInternalRecord deleteRecord = new JournalDeleteRecord(id);
JournalFile usedFile = appendRecord(deleteRecord, false, sync, null, callback);
if (logger.isTraceEnabled()) {
logger.trace("appendDeleteRecord::id=" + id + ", usedFile = " + usedFile);
}
// computing the delete should be done after compacting is done
if (record == null) {
compactor.addCommandDelete(id, usedFile);
} else {
record.delete(usedFile);
}
result.set(true);
} catch (Exception e) {
result.fail(e);
logger.error("appendDeleteRecord:" + e, e);
} finally {
journalLock.readLock().unlock();
}
}
});
result.get();
}
use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecord in project activemq-artemis by apache.
the class FileWrapperJournal method appendDeleteRecord.
@Override
public void appendDeleteRecord(long id, boolean sync, IOCompletion callback) throws Exception {
JournalInternalRecord deleteRecord = new JournalDeleteRecord(id);
writeRecord(deleteRecord, false, -1, false, callback);
}
Aggregations