Changeset 31631 for main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
- Timestamp:
- 2017-04-21T20:00:54+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
r31602 r31631 485 485 // handle each incoming line from stdout and stderr streams, and any exceptions that occur then 486 486 SafeProcess.CustomProcessHandler processOutHandler 487 = new SynchronizedProcessHandler(bw, S ynchronizedProcessHandler.STDOUT);487 = new SynchronizedProcessHandler(bw, SafeProcess.STDOUT); 488 488 SafeProcess.CustomProcessHandler processErrHandler 489 = new SynchronizedProcessHandler(bw, S ynchronizedProcessHandler.STDERR);489 = new SynchronizedProcessHandler(bw, SafeProcess.STDERR); 490 490 491 491 // GS2PerlConstructor will do further handling of exceptions that may occur during the perl … … 700 700 // exceptions when reading from our perl process' stderr and stdout streams are handled by 701 701 // SynchronizedProcessHandler.gotException() below, since they happen in separate threads 702 // from this one (the ine from which the perl process is run).702 // from this one (the one from which the perl process is run). 703 703 public synchronized void gotException(Exception e) { 704 704 … … 719 719 // we do that here too, to continue original behaviour. These calls are also synchronized to make their 720 720 // use of the EventListeners threadsafe. 721 protected class SynchronizedProcessHandler implements SafeProcess.CustomProcessHandler721 protected class SynchronizedProcessHandler extends SafeProcess.CustomProcessHandler 722 722 { 723 public static final int STDERR = 0;724 public static final int STDOUT = 1;725 726 private final int source;727 723 private final BufferedWriter bwHandle; // needs to be final to synchronize on the object 728 724 729 730 725 public SynchronizedProcessHandler(BufferedWriter bw, int src) { 726 super(src); // will set this.source to STDERR or STDOUT 731 727 this.bwHandle = bw; // caller will close bw, since many more than one 732 728 // SynchronizedProcessHandlers are using it 733 this.source = src; // STDERR or STDOUT734 729 } 735 730 … … 751 746 752 747 753 //if(this.source == S TDERR) {748 //if(this.source == SafeProcess.STDERR) { 754 749 ///System.err.println("ERROR: " + line); 755 750 //} else { … … 767 762 } 768 763 } catch(IOException ioe) { 769 String msg = ( source ==STDERR) ? "stderr" : "stdout";764 String msg = (this.source == SafeProcess.STDERR) ? "stderr" : "stdout"; 770 765 msg = "Exception when writing out a line read from perl process' " + msg + " stream."; 771 766 GS2PerlConstructor.logger.error(msg, ioe); … … 780 775 } catch (IOException ioe) { // problem with reading in from process with BufferedReader br 781 776 782 String msg = ( source ==STDERR) ? "stderr" : "stdout";777 String msg = (this.source == SafeProcess.STDERR) ? "stderr" : "stdout"; 783 778 msg = "Got exception when processing the perl process' " + msg + " stream."; 784 779 GS2PerlConstructor.logger.error(msg, ioe); … … 821 816 // http://stackoverflow.com/questions/14211629/java-util-logger-write-synchronization 822 817 823 String msg = ( source ==STDERR) ? "stderr" : "stdout";818 String msg = (this.source == SafeProcess.STDERR) ? "stderr" : "stdout"; 824 819 msg = "IOException when writing out a line read from perl process' " + msg + " stream."; 825 820 msg += "\nGot line: " + line + "\n";
Note:
See TracChangeset
for help on using the changeset viewer.