Open tecnogram888 opened 12 years ago
I added a skeleton so you can see where you come in
If you do a few, i can see how it's done..I can do a few too if it ends up being too many
other people can chip in also
code:
while (true) {
switch (TPCState) {
// send the appropriate message to client
case INIT:
if (isPutReq) {
// LUKE SEND 2PC Put Value Request
} else {
// LUKE SEND 2PC Del Value Request
}
break;
case WAIT:
// Luke send right message
break;
case ABORT:
// Luke send message
break;
case COMMIT:
// Luke send message
break;
default:
return;
}
// TODO: Listen for response from client
boolean nextStep = true; // LUKE SET THIS VALUE TO true if we receive the right message, false if not
boolean commit = true; // LUKE SET THIS VALUE based on message received
if (nextStep) {
otherThreadDoneLock.lock();
if (otherThreadDone == false) {
otherThreadDone = true;
} else {
otherThreadDone = false;
// move on to appropriate state.
}
otherThreadDoneLock.unlock();
}
}
Implement details: two phase commit
FOUR PARTS:
INIT WAIT Abort Commit