feat(tailer): added parameter to Tailer call
This commit is contained in:
parent
39a75c0119
commit
13175399f6
|
@ -7,13 +7,30 @@ import java.io.File;
|
|||
|
||||
public class Main {
|
||||
|
||||
//delay between checks of the file for new content in milliseconds
|
||||
public static final int DELAY_MILLIS = 500;
|
||||
|
||||
//set to true to tail from the end of the file, false to tail from the beginning of the file
|
||||
public static final boolean END = true;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
|
||||
TailerListener listener = new MyListener();
|
||||
Tailer tailer = new Tailer(new File("NetPeerManager.log"), listener, 500);
|
||||
|
||||
//create and use a Tailer with a Thread
|
||||
String fileName = "NetPeerManager.log";
|
||||
//TODO What is the behaviour of the reOpen parameter?
|
||||
Tailer tailer = new Tailer(new File(fileName), listener, DELAY_MILLIS, END);
|
||||
tailer.run();
|
||||
|
||||
Thread thread = new Thread(tailer);
|
||||
|
||||
//optional
|
||||
thread.setDaemon(true);
|
||||
|
||||
thread.start();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue