Blocking Thread - Java

here is my problem: I have an application that runs a simulated server locally. The result of this operation is redirected to the log file, and I want to search for a specific template in this log file at the time of writing.

I already implemented tail -f simulation (I need to work with windows), but I can not get both threads to work fine at the same time.

Here's a sample (mostly):

server.launch();
patternFinder.start();

The Finder template extends the stream, and here is what its launch method looks like:

public void run() {
    while (true) {
        //tail -f implementation

        //I'll set a timeout when I can get it 
        //to work (the pattern is supposed to be found)
    }
}

patternFinder.join() start(), patternFinder ( , ). , , - , ( ).

?

(ps: , , - )

+3
2

, , - , , .

-, , ProcessBuilder , java [arguments] [classpath] fileToLaunch. , , , cmd /C start java [arguments] [classpath] fileToLaunch, , .

- , , .

0

Events . / reset , .

Manual AutoResetEvents. , Java, , .

0

All Articles