import java.util.Timer;
import java.util.TimerTask;
public class SyncTest {
public static final int NUMBER_TO_USE = 1000000;
public static void main(String[] args) {
final Controller controller = new Controller();
System.out.println("Before Adding");
controller.addSome(NUMBER_TO_USE);
System.out.println("Before Remove");
TimerTask getBufferTask = new TimerTask() {
public void run() {
TestBuffer buffer = controller.getBuffer();
buffer.getBuffer();
}
};
Timer getBufferTimer = new Timer(true);
getBufferTimer.scheduleAtFixedRate(getBufferTask, 0, 33);
for(int i=0;i<NUMBER_TO_USE;i++){
controller.remove();
}
System.out.println("Done");
}
}