package fr.inria.jessy.protocol;


import java.util.Set;

import fr.inria.jessy.communication.JessyGroupManager;
import fr.inria.jessy.store.DataStore;
import fr.inria.jessy.transaction.ExecutionHistory;
import fr.inria.jessy.transaction.termination.TwoPhaseCommit;

/**
 * This class implements Non-Monotonic Snapshot Isolation consistency criterion.
 * 
 * @author Masoud Saeida Ardekani
 * 
 */
public class NMSI_PDV_2PC extends NMSI_PDV_GC {

	
	public NMSI_PDV_2PC(JessyGroupManager m, DataStore dataStore) {
		super(m, dataStore);
	}

	/**
	 * Coordinator needs to only wait for the vote from the 2PC manager. 
	 * 	
	 */
	@Override
	public Set<String> getVotersToJessyProxy(
			Set<String> termincationRequestReceivers,
			ExecutionHistory executionHistory) {
		termincationRequestReceivers.clear();
		termincationRequestReceivers.add(TwoPhaseCommit.getCoordinatorId(executionHistory,manager.getPartitioner()));
		return termincationRequestReceivers;
	}
}

@@ -258,16 +258,73 @@
 eCommit;
+%0Aimport fr.inria.jessy.transaction.termination.vote.Vote;
 %0A%0A/**%0A *
@@ -1011,10 +1011,341 @@
 ers;%0A%09%7D%0A
+%09%0A%09@Override%0A%09public void voteReceived(Vote vote) %7B%0A%09%09%0A%09%09/*%0A%09%09 * if vote.getVotePiggyBack() is null, it means that it is preemptively aborted in DistributedTermination, and%0A%09%09 * DistributedTermination sets votePiggyback to null. %0A%09%09 *  %0A%09%09 */%0A%09%09if (vote.getVotePiggyBack()==null )%7B%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09super.voteReceived(vote);%0A%09%7D%0A
 %7D%0A

Fix the blocking problem of NMSI with 2PC.