- }\r
- comStream.append("\n\n# program environment\n");\r
- for (Entry<String, String> var : pbuilder.environment().entrySet()) {\r
- comStream.append(var.getKey() + " =\t" + var.getValue() + "\n");\r
- }\r
- comStream.close();\r
-\r
- // any error message?\r
- errorStream = new PrintStream(new File(pbuilder.directory() + File.separator + getError()));\r
- StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), errorStream, OutputType.ERROR);\r
-\r
- // any output?\r
- outStream = new PrintStream(new File(pbuilder.directory() + File.separator + getOutput()));\r
- StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), outStream, OutputType.OUTPUT);\r
-\r
- // kick it off\r
- errorf = es.submit(errorGobbler);\r
- outputf = es.submit(outputGobbler);\r
-\r
- // any error???\r
- int exitVal = proc.waitFor();\r
- log.info("Calculation completed at " + System.nanoTime());\r
- EngineUtil.writeStatFile(confExec.getWorkDirectory(), JobStatus.FINISHED.toString());\r
- // Let streams to write for a little more\r
- errorf.get(2, TimeUnit.SECONDS);\r
- outputf.get(2, TimeUnit.SECONDS);\r
-\r
- // Close streams\r
- errorStream.close();\r
- outStream.close();\r
- log.debug("Local process exit value: " + exitVal);\r
- } catch (ExecutionException e) {\r
- // Log and ignore this is not important\r
- log.trace("Native Process output threw exception: " + e.getMessage());\r
- } catch (TimeoutException e) {\r
- // Log and ignore this is not important\r
- log.trace("Native Process output took longer then 2s to write, aborting: " + e.getMessage());\r
- } catch (InterruptedException e) {\r
- log.error("Native Process was interrupted aborting: " + e.getMessage());\r
- proc.destroy();\r
- errorf.cancel(true);\r
- outputf.cancel(true);\r
- // restore interruption status\r
- Thread.currentThread().interrupt();\r
- } finally {\r
- // just to make sure that we do not left anything running\r
- if (proc != null) {\r
+ }\r
+ comStream.append("\n\n# program environment\n");\r
+ for (Entry<String, String> var : pbuilder.environment().entrySet()) {\r
+ comStream.append(var.getKey() + " =\t" + var.getValue() + "\n");\r
+ }\r
+ comStream.close();\r
+\r
+ // any error message?\r
+ errorStream = new PrintStream(new File(pbuilder.directory() + File.separator + getError()));\r
+ StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), errorStream, OutputType.ERROR);\r
+\r
+ // any output?\r
+ outStream = new PrintStream(new File(pbuilder.directory() + File.separator + getOutput()));\r
+ StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), outStream, OutputType.OUTPUT);\r
+\r
+ // kick it off\r
+ errorf = es.submit(errorGobbler);\r
+ outputf = es.submit(outputGobbler);\r
+\r
+ // any error???\r
+ int exitVal = proc.waitFor();\r
+ //proc.getClass();\r
+ log.info("Calculation completed at " + System.nanoTime());\r
+ EngineUtil.writeStatFile(confExec.getWorkDirectory(), JobStatus.FINISHED.toString());\r
+\r
+ // Let streams to write for a little more\r
+ errorf.get(2, TimeUnit.SECONDS);\r
+ outputf.get(2, TimeUnit.SECONDS);\r
+\r
+ // Close streams\r
+ errorStream.close();\r
+ outStream.close();\r
+ log.debug("Local process exit value: " + exitVal);\r
+ } catch (ExecutionException e) {\r
+ // Log and ignore this is not important\r
+ log.trace("Native Process output threw exception: " + e.getMessage());\r
+ } catch (TimeoutException e) {\r
+ // Log and ignore this is not important\r
+ log.trace("Native Process output took longer then 2s to write, aborting: " + e.getMessage());\r
+ } catch (InterruptedException e) {\r
+ log.error("Native Process was interrupted aborting: " + e.getMessage());\r
+ System.err.println("Native Process was interrupted aborting: " + e.getMessage());\r