Advertisement
lukejessee

Sync Issue - SyncTest.java

Jun 13th, 2012
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement