From ef6851798b8e8c452f83bda8dd64b45bff8b20e7 Mon Sep 17 00:00:00 2001 From: theli Date: Wed, 8 Jun 2005 13:23:35 +0000 Subject: [PATCH] *) changing thread priority while parsing a pdf file to avoid 100% CPU usage. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@222 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/parser/pdf/pdfParser.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/plasma/parser/pdf/pdfParser.java b/source/de/anomic/plasma/parser/pdf/pdfParser.java index 41230b2a0..ee76ec6e5 100644 --- a/source/de/anomic/plasma/parser/pdf/pdfParser.java +++ b/source/de/anomic/plasma/parser/pdf/pdfParser.java @@ -93,10 +93,12 @@ public class pdfParser extends AbstractParser implements Parser { PDDocument theDocument = null; OutputStreamWriter writer = null; try { + // reducing thread priority + Thread.currentThread().setPriority(Thread.MIN_PRIORITY); // deactivating the logging for jMimeMagic - Logger theLogger = Logger.getLogger("org.pdfbox"); - theLogger.setLevel(Level.INFO); +// Logger theLogger = Logger.getLogger("org.pdfbox"); +// theLogger.setLevel(Level.INFO); String docTitle = null, docSubject = null, docAuthor = null, docKeyWords = null; @@ -159,6 +161,7 @@ public class pdfParser extends AbstractParser implements Parser { } finally { if (theDocument != null) try { theDocument.close(); } catch (Exception e) {} if (writer != null) try { writer.close(); } catch (Exception e) {} + Thread.currentThread().setPriority(Thread.NORM_PRIORITY); } }