Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Sync Issue - SyncTest.java

By: lukejessee on Jun 13th, 2012  |  syntax: Java  |  size: 0.72 KB  |  views: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.Timer;
  2. import java.util.TimerTask;
  3.  
  4.  
  5. public class SyncTest {
  6.         public static final int NUMBER_TO_USE = 1000000;
  7.        
  8.         public static void main(String[] args) {
  9.                 final Controller controller = new Controller();
  10.                 System.out.println("Before Adding");
  11.                
  12.                 controller.addSome(NUMBER_TO_USE);
  13.                
  14.                 System.out.println("Before Remove");
  15.                
  16.                 TimerTask getBufferTask = new TimerTask() {
  17.                         public void run() {
  18.                                 TestBuffer buffer = controller.getBuffer();
  19.                                 buffer.getBuffer();
  20.                         }
  21.                 };
  22.  
  23.                 Timer getBufferTimer = new Timer(true);
  24.                 getBufferTimer.scheduleAtFixedRate(getBufferTask, 0, 33);
  25.                
  26.                 for(int i=0;i<NUMBER_TO_USE;i++){
  27.                         controller.remove();
  28.                 }
  29.                
  30.                 System.out.println("Done");
  31.         }
  32. }