SevenZipIngestModule: only check 7zip init once

This commit is contained in:
Samuel H. Kenyon 2014-04-09 14:07:05 -04:00
parent be4f3194fc
commit 1e255f0979
2 changed files with 20 additions and 15 deletions

View File

@ -90,6 +90,7 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
private final byte[] fileHeaderBuffer = new byte[readHeaderSize]; private final byte[] fileHeaderBuffer = new byte[readHeaderSize];
private static final int ZIP_SIGNATURE_BE = 0x504B0304; private static final int ZIP_SIGNATURE_BE = 0x504B0304;
private IngestJobContext context; private IngestJobContext context;
private long jobId;
SevenZipIngestModule() { SevenZipIngestModule() {
} }
@ -97,6 +98,7 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
@Override @Override
public void startUp(IngestJobContext context) throws IngestModuleException { public void startUp(IngestJobContext context) throws IngestModuleException {
this.context = context; this.context = context;
jobId = context.getJobId();
final Case currentCase = Case.getCurrentCase(); final Case currentCase = Case.getCurrentCase();
@ -121,6 +123,8 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
} }
} }
// if first instance of this module for this job then check 7zip init
if (IngestModuleAdapter.moduleRefCountIncrement(jobId) == 1) {
try { try {
SevenZip.initSevenZipFromPlatformJAR(); SevenZip.initSevenZipFromPlatformJAR();
String platform = SevenZip.getUsedPlatform(); String platform = SevenZip.getUsedPlatform();
@ -134,6 +138,7 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
services.postMessage(IngestMessage.createErrorMessage(ArchiveFileExtractorModuleFactory.getModuleName(), msg, details)); services.postMessage(IngestMessage.createErrorMessage(ArchiveFileExtractorModuleFactory.getModuleName(), msg, details));
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}
archiveDepthCountTree = new ArchiveDepthCountTree(); archiveDepthCountTree = new ArchiveDepthCountTree();
} }

View File

@ -128,9 +128,9 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
tikaFormatDetector = new Tika(); tikaFormatDetector = new Tika();
ingester = Server.getIngester(); ingester = Server.getIngester();
// increment the module reference count
// if first instance of this module for this job then check the server and existence of keywords
if (IngestModuleAdapter.moduleRefCountIncrement(jobId) == 1) { if (IngestModuleAdapter.moduleRefCountIncrement(jobId) == 1) {
// if first module for this job then check the server and existence of keywords
final Server server = KeywordSearch.getServer(); final Server server = KeywordSearch.getServer();
try { try {
if (!server.isRunning()) { if (!server.isRunning()) {