@@ -179,8 +179,8 @@ private static Path executablePath(String cmd) {
179179 }
180180
181181 private static class ProcessStreamReader extends Thread {
182- private volatile BufferedReader reader ;
183- private boolean terminated = false ;
182+ private final BufferedReader reader ;
183+ private volatile boolean terminated = false ;
184184
185185 ProcessStreamReader (InputStream inputStream ) {
186186 super ("Local GCD InputStream reader" );
@@ -195,15 +195,15 @@ void terminate() throws IOException {
195195
196196 @ Override
197197 public void run () {
198- try {
199- while (! terminated ) {
198+ while (! terminated ) {
199+ try {
200200 String line = reader .readLine ();
201201 if (line == null ) {
202202 terminated = true ;
203203 }
204+ } catch (IOException e ) {
205+ // ignore
204206 }
205- } catch (IOException e ) {
206- // ignore
207207 }
208208 }
209209
@@ -219,11 +219,11 @@ private static class ProcessErrorStreamReader extends Thread {
219219 private static final String GCD_LOGGING_CLASS =
220220 "com.google.apphosting.client.serviceapp.BaseApiServlet" ;
221221
222- private volatile BufferedReader errorReader ;
222+ private final BufferedReader errorReader ;
223223 private String currentLog = null ;
224224 private Level currentLogLevel = null ;
225225 private boolean collectionMode = false ;
226- private boolean terminated = false ;
226+ private volatile boolean terminated = false ;
227227
228228 ProcessErrorStreamReader (InputStream errorStream , String blockUntil ) throws IOException {
229229 super ("Local GCD ErrorStream reader" );
@@ -245,10 +245,10 @@ void terminate() throws IOException {
245245
246246 @ Override
247247 public void run () {
248- try {
249- String previousLine = "" ;
250- String nextLine = "" ;
251- while (! terminated ) {
248+ String previousLine = "" ;
249+ String nextLine = "" ;
250+ while (! terminated ) {
251+ try {
252252 previousLine = nextLine ;
253253 nextLine = errorReader .readLine ();
254254 if (nextLine == null ) {
@@ -257,9 +257,9 @@ public void run() {
257257 } else {
258258 processLogLine (previousLine , nextLine );
259259 }
260+ } catch (IOException e ) {
261+ // ignore
260262 }
261- } catch (IOException e ) {
262- // ignore
263263 }
264264 }
265265
0 commit comments