Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/wsplgen/WSPLGENCallable.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | af13ceeba52a |
children | 2dba91c00c72 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
30 | 30 |
31 public static final String WSPLGEN_BIN_PATH = | 31 public static final String WSPLGEN_BIN_PATH = |
32 System.getProperty("wsplgen.bin.path"); | 32 System.getProperty("wsplgen.bin.path"); |
33 | 33 |
34 | 34 |
35 private Logger logger = Logger.getLogger(WSPLGENCallable.class); | 35 private Logger log = Logger.getLogger(WSPLGENCallable.class); |
36 | 36 |
37 private Process process; | 37 private Process process; |
38 | 38 |
39 protected Scheduler scheduler; | 39 protected Scheduler scheduler; |
40 | 40 |
67 return job; | 67 return job; |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 protected void execute(String[] args, File dir) { | 71 protected void execute(String[] args, File dir) { |
72 logger.info("Start JobExecutor for artifact: " + dir.getName()); | 72 log.info("Start JobExecutor for artifact: " + dir.getName()); |
73 | 73 |
74 try { | 74 try { |
75 synchronized (this) { | 75 synchronized (this) { |
76 process = Runtime.getRuntime().exec(args, null, dir); | 76 process = Runtime.getRuntime().exec(args, null, dir); |
77 | 77 |
83 | 83 |
84 try { | 84 try { |
85 process.waitFor(); | 85 process.waitFor(); |
86 } | 86 } |
87 catch (InterruptedException ie) { | 87 catch (InterruptedException ie) { |
88 logger.warn("WSPLGEN job interrupted: " + ie.getMessage()); | 88 log.warn("WSPLGEN job interrupted: " + ie.getMessage()); |
89 } | 89 } |
90 | 90 |
91 try { | 91 try { |
92 logObserver.join(); | 92 logObserver.join(); |
93 errorObserver.join(); | 93 errorObserver.join(); |
94 } | 94 } |
95 catch (InterruptedException iee) { /* do nothing */ } | 95 catch (InterruptedException iee) { /* do nothing */ } |
96 | 96 |
97 logger.info("WSPLGEN exit value: " + process.exitValue()); | 97 log.info("WSPLGEN exit value: " + process.exitValue()); |
98 logger.info( | 98 log.info( |
99 "WSPLGEN throw " + | 99 "WSPLGEN throw " + |
100 errorObserver.numErrors() + " errors."); | 100 errorObserver.numErrors() + " errors."); |
101 logger.info( | 101 log.info( |
102 "WSPLGEN throw " + | 102 "WSPLGEN throw " + |
103 errorObserver.numWarnings() + " warnings."); | 103 errorObserver.numWarnings() + " warnings."); |
104 | 104 |
105 if (process.exitValue() < 2 && errorObserver.numErrors() == 0) { | 105 if (process.exitValue() < 2 && errorObserver.numErrors() == 0) { |
106 FacetCreator fc = job.getFacetCreator(); | 106 FacetCreator fc = job.getFacetCreator(); |
114 | 114 |
115 return; | 115 return; |
116 } | 116 } |
117 } | 117 } |
118 catch (SecurityException se) { | 118 catch (SecurityException se) { |
119 logger.error(se); | 119 log.error(se); |
120 } | 120 } |
121 catch (IOException ioe) { | 121 catch (IOException ioe) { |
122 logger.error(ioe); | 122 log.error(ioe); |
123 } | 123 } |
124 catch (NullPointerException npe) { | 124 catch (NullPointerException npe) { |
125 logger.error(npe, npe); | 125 log.error(npe, npe); |
126 } | 126 } |
127 catch (IndexOutOfBoundsException ioobe) { | 127 catch (IndexOutOfBoundsException ioobe) { |
128 logger.error(ioobe, ioobe); | 128 log.error(ioobe, ioobe); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 public void cancelWSPLGEN() { | 133 public void cancelWSPLGEN() { |
134 if (process != null) { | 134 if (process != null) { |
135 logger.debug("Cancel running WSPLGEN process."); | 135 log.debug("Cancel running WSPLGEN process."); |
136 process.destroy(); | 136 process.destroy(); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 | 140 |