Beispiel #1
0
 public void addAll(CompositeQueue tempCommandQueue)
 {
     foreach (int key in tempCommandQueue.getMap().Keys)
     {
         Command modelCommand = tempCommandQueue.getMap()[key];
         insertMessage(key, modelCommand);
     }
 }
Beispiel #2
0
 public CommandQueue()
 {
     currentVersion=0;
     set=new HashSet<Int32>();
     commandQueue=new CompositeQueue();
     tempCommandQueue =new CompositeQueue();
     timer=new Timer();
     mode=Mode.normal;
 }
Beispiel #3
0
 public int toMode(Mode mode)
 {
     try{
         reentrantLock.enter();
         if(mode.Equals(Mode.image)){
             this.mode=Mode.locking;
             while(commandQueue.isNotEmpty()){
                 Zzz.zzz(100);
             }
             this.mode=Mode.image;
             log.info("ready for image command queue is locked current version is " +currentVersion);
         }else{
             lock (this){
                 this.mode=Mode.normal;
                 commandQueue.addAll(tempCommandQueue);
                 tempCommandQueue =new CompositeQueue();
                 System.Threading.Monitor.Pulse(this);
                 log.info("releasing queue current version is " +currentVersion);
             }
         }
         return currentVersion;
     }finally {
         reentrantLock.exit();
     }
 }