19
19
20
20
/*
21
21
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
22
- * Portions Copyright (c) 2017, Chris Fraire <[email protected] >.
22
+ * Portions Copyright (c) 2017-2018 , Chris Fraire <[email protected] >.
23
23
*/
24
24
package org .opensolaris .opengrok .analysis ;
25
25
@@ -392,9 +392,10 @@ public Definitions doCtags(String file) throws IOException,
392
392
393
393
Thread clientThread = Thread .currentThread ();
394
394
ScheduledFuture futureTimeout = schedExecutor .schedule (() -> {
395
+ LOGGER .log (Level .WARNING , "Ctags futureTimeout executing." );
395
396
clientThread .interrupt ();
396
397
outThread .interrupt ();
397
- LOGGER . log ( Level . WARNING , "Ctags futureTimeout executed." );
398
+ ctags . destroyForcibly ( );
398
399
}, CTAGSWAIT_S , TimeUnit .SECONDS );
399
400
400
401
Definitions ret ;
@@ -404,6 +405,13 @@ public Definitions doCtags(String file) throws IOException,
404
405
ctagsIn .flush ();
405
406
if (Thread .interrupted ()) throw new InterruptedException ("flush()" );
406
407
ret = buffer .take ();
408
+ } catch (IOException ex ) {
409
+ /*
410
+ * In case the ctags process had to be destroyed, possibly pre-empt
411
+ * the IOException with an InterruptedException.
412
+ */
413
+ if (Thread .interrupted ()) throw new InterruptedException ("I/O" );
414
+ throw ex ;
407
415
} finally {
408
416
futureTimeout .cancel (false );
409
417
}
@@ -537,6 +545,9 @@ private void outThreadStart() {
537
545
CtagsReader rdr = new CtagsReader ();
538
546
try {
539
547
readTags (rdr );
548
+ if (Thread .interrupted ()) {
549
+ throw new InterruptedException ("readTags()" );
550
+ }
540
551
Definitions defs = rdr .getDefinitions ();
541
552
buffer .put (defs );
542
553
} catch (InterruptedException ex ) {
0 commit comments