private void causalOrder()
        {	
        	System.out.println("!! causalorder checking ");
	        	
        	MultiCastMessage msg = null;
        	while((msg = recvQueue.peek())!=null){
        		//System.out.println("##msg not null: "+msg.toString());
        		if(msg.getLockType()==LockType.REQUEST){
        			System.out.println("## receive request from "+msg.getSource());
        			 String displayMsg = String.format("%s: receive request from %s\n", local_name,msg.getSource());
	                    UIThread.textArea.append(displayMsg);
					
        			if(state == LockState.HELD || voted == true){
        				System.out.println("##held or voted, adding request to queue+"+msg.getRequestTS());
        				 displayMsg = String.format("%s: held or voted, adding request to queue\n", local_name);
	                    UIThread.statusArea.append(displayMsg);
        				Request e = new Request(msg.getRequestTS().getTime(),msg.getSource());
        				requestQueue.add(e);
        			}
        			else{//vote for it
        				TimeStampedMessage vote = new TimeStampedMessage(msg.getSource(), null, "this is vote msg from "+local_name, null);
        				vote.setLockType(LockType.VOTE);
        				System.out.println("## voting for "+msg.getSource());
        				 displayMsg = String.format("%s: voting for %s\n", local_name,msg.getSource());
 	                    UIThread.textArea.append(displayMsg);
 	                   displayMsg = String.format("%s: voted for %s\n", local_name,msg.getSource());
	                    
 	                   UIThread.statusArea.append(displayMsg);
         				
        				try {
							send(vote);
						} catch (UnknownHostException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
        				voted = true;
        			}
        			recvQueue.poll();
        		}
        		else if(msg.getLockType()==LockType.RELEASE){
        			System.out.println("## release received from "+msg.getSource());
        			 String displayMsg = String.format("%s: vrelease received from  %s\n", local_name,msg.getSource());
	                    UIThread.textArea.append(displayMsg);
	                    displayMsg = String.format("%s: release  from %s\n", local_name,msg.getSource());
	                    
	 	                   UIThread.statusArea.append(displayMsg);
      				if(!requestQueue.isEmpty()){
        				System.out.println("## request queue not empty");
        				timeSort(requestQueue);
    					Request head = requestQueue.poll();
    					TimeStampedMessage vote = new TimeStampedMessage(head.name, null, "this is vote msg from "+local_name, null);
    					vote.setLockType(LockType.VOTE);
    					System.out.println("## voting for "+head.name);
    					displayMsg = String.format("%s: voted for  %s\n", local_name,head.name);
	                    UIThread.statusArea.append(displayMsg);
	                    UIThread.textArea.append(displayMsg);
    					try {
							send(vote);
						} catch (UnknownHostException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
    					voted = true;
    				
    				}
    				else{
    					System.out.println("## request queue empty, not voting");
    					voted = false;
    					state = LockState.RELEASED;
    				}
        			recvQueue.poll();
        		}
        		else
        			deliveryBuffer.offer(recvQueue.poll());
        	}
        	
        }