Skip to content

Commit dc939fe

Browse files
committed
Also check outThread in isClosed() in case it dies unexpectedly
1 parent 282a683 commit dc939fe

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/org/opensolaris/opengrok/analysis/Ctags.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import org.opensolaris.opengrok.util.IOUtils;
4040

4141
/**
42-
* Provides Ctags by having a running instance of ctags
42+
* Provides Ctags by having a running subprocess of ctags.
4343
*
4444
* @author Chandan
4545
*/
@@ -53,8 +53,8 @@ public class Ctags {
5353
private volatile boolean closing;
5454
private volatile boolean signalled;
5555
private Process ctags;
56-
Thread errThread;
57-
Thread outThread;
56+
private Thread errThread;
57+
private Thread outThread;
5858
private OutputStreamWriter ctagsIn;
5959
private BufferedReader ctagsOut;
6060
private static final String CTAGS_FILTER_TERMINATOR = "__ctags_done_with_file__";
@@ -65,8 +65,15 @@ public class Ctags {
6565

6666
private boolean junit_testing = false;
6767

68+
/**
69+
* Gets a value indicating if a subprocess of ctags was started and either:
70+
* 1) it is not alive; or 2) any necessary supporting thread is not alive.
71+
* @return {@code true} if the instance should be considered closed and no
72+
* longer usable.
73+
*/
6874
public boolean isClosed() {
69-
return ctags != null && !ctags.isAlive();
75+
return ctags != null && (!ctags.isAlive() || outThread == null ||
76+
!outThread.isAlive());
7077
}
7178

7279
public String getBinary() {

0 commit comments

Comments
 (0)