I try to generate data set using multiple threads
I tried to create a Runnable and a couple of Threads in the following
public class DataGenerator {
static int currentRow = 0 ;
static PrintWriter pw ;
public static void main(String[] args) throws FileNotFoundException {
File file = new File("Test3.csv") ;
pw = new PrintWriter(file);
pw.println("var1,var2,var3") ;
Thread t1 = new Thread(new MyRunnable()) ;
Thread t2 = new Thread(new MyRunnable()) ;
t1.start();
t2.start();
t1.join();
t2.join();
pw.close();
System.exit(0) ;
}
}
class MyRunnable implements Runnable {
public void run () {
for ( int i = DataGenerator.currentRow; i < 50000000; DataGenerator.currentRow ++ ) {
DataGenerator.pw.println(i + ",19:05.1,some text");
System.out.println(i);
}
}
}
However is looping over o
I cant find out why