return null;
}
if (binary instanceof InMemoryBinaryValue) {
// The extracted text will never be stored, so try directly using the text extractors ...
return extractors.extract((InMemoryBinaryValue)binary, new TextExtractorContext(detector()));
}
// there isn't any text available, so wait for a job to finish and then return the result
try {
CountDownLatch latch = extractors.getWorkerLatch(binary.getKey(), false);
if (latch == null) {
// There is no latch, so just compute the text here ...
latch = extractors.extract(this, binary, new TextExtractorContext(detector()));
}
// There was a latch, so wait till the work is done ...
if (latch != null && latch.await(DEFAULT_LATCH_WAIT_IN_SECONDS, TimeUnit.SECONDS)) {
return getExtractedText(binary);
}