Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r339 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r339 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft


Chronological Thread 
  • From: "AFS account Stadler Hans Christian" <stadler_h AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r339 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft
  • Date: Thu, 12 Mar 2009 16:20:31 +0100
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: stadler_h
Date: Thu Mar 12 16:20:31 2009
New Revision: 339

Log:
Watchdog timer to prevent deadlock in futex while connecting to openoffice

Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java

trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java

Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
==============================================================================
--- trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
(original)
+++ trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
Thu Mar 12 16:20:31 2009
@@ -307,8 +307,9 @@
Throwable connectEx = null;
for (int retry = 3; (unoObj == null) && (retry > 0); --retry) {
try {
- unoObj =
urlResolver.resolve("uno:socket,host=localhost,port="
- + unoPort + ";urp;StarOffice.ServiceManager");
+ unoObj = urlResolver.resolve("uno:" +
+ MSOfficeExtractorFactory.connectString(unoPort) +
+ "StarOffice.ServiceManager");
} catch (Throwable ex) {
logger.finest("OpenOffice connection error, remaining
retries: "+(retry - 1));
connectEx = ex;

Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
==============================================================================
---
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
(original)
+++
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
Thu Mar 12 16:20:31 2009
@@ -138,6 +138,22 @@
logger.fine("Killed process "+process+" due to lack of
progress");
}
}
+
+ /**
+ * @brief Timer task for interrupting OpenOffice connection attempts
+ */
+ final class TimeoutTimerTask extends TimerTask {
+ private Thread snail;
+ TimeoutTimerTask(Thread thread) {
+ snail = thread;
+ }
+
+ @Override
+ public void run() {
+ snail.interrupt();
+ logger.fine("Interrupted thread " + snail + "due to lack of
progress");
+ }
+ }

/**
* @brief Class implementing a thread for reading an error stream.
@@ -438,7 +454,7 @@
"soffice");
procBuilder = new ProcessBuilder("bash", "-c",
soffice +
- " -accept='socket,host=localhost,port=" + unoPort +
";urp;'" +
+ " -accept='" + connectString(unoPort) + "'" +
" -headless" +
" -invisible" +
" -display " + screen);
@@ -458,16 +474,22 @@
Throwable connectEx = null;
logger.finest("Starting OO process");
soffice = procBuilder.start();
+ Timer timer = new Timer("OpenOffice Connection Timeout
Watchdog");
+ TimeoutTimerTask watchdog = new
TimeoutTimerTask(Thread.currentThread());
for (int retry = 30; (unoObj == null) && (retry > 0); --retry) {
try {
- unoObj =
urlResolver.resolve("uno:socket,host=localhost,port=" + unoPort
- + ";urp;StarOffice.ServiceManager");
+ timer.schedule(watchdog , 200);
+ unoObj = urlResolver.resolve("uno:" +
connectString(unoPort) +
+ "StarOffice.ServiceManager");
} catch (Throwable ex) {
logger.finest("Can't connect to OO, "+retry+" retries
remaining\n"+ex);
connectEx = ex;
Thread.sleep(200);
+ } finally {
+ watchdog.cancel();
}
}
+ timer.cancel();

if (unoObj == null) {
InputStream pOut = null;
@@ -520,6 +542,12 @@
}
}

+ /** @brief Return the OpenOffice connection method string */
+ static String connectString(String unoPort) {
+ return "socket,host=localhost,port=" + unoPort +
",tcpNoDelay=1;urp;";
+ //return "pipe,name=indexer-pipe-" + unoPort + ";urp;";
+ }
+
/** @see ContentExtractorFactory.initialize() */
public void initialize(Config config) throws DmsException {
try {



  • [idok-commit] idok commit r339 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft, AFS account Stadler Hans Christian, 03/12/2009

Archive powered by MHonArc 2.6.19.

Top of Page