import java.util.Collection;
import java.util.Collections;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Collections;
import java.nio.ByteBuffer;
private Map<Long, TransactionStatus> transactionStatusMap = null;
private Map<Long, TransactionStatus> transactionStatusNotSentMap = null;
private Map<Long, TransactionStatus> transactionStatusMap = null;
private Map<Long, TransactionStatus> transactionStatusNotSentMap = null;
public Table(String hostname, String baseurl, String password, long _localmachineid) {
localmachineid = _localmachineid;
public Table(String hostname, String baseurl, String password, long _localmachineid) {
localmachineid = _localmachineid;
localCommunicationChannels = new HashMap<Long, LocalComm>();
transactionStatusMap = new HashMap<Long, TransactionStatus>();
transactionStatusNotSentMap = new HashMap<Long, TransactionStatus>();
localCommunicationChannels = new HashMap<Long, LocalComm>();
transactionStatusMap = new HashMap<Long, TransactionStatus>();
transactionStatusNotSentMap = new HashMap<Long, TransactionStatus>();
Slot[] newslots = cloud.getSlots(sequencenumber + 1);
validateandupdate(newslots, true);
Slot[] newslots = cloud.getSlots(sequencenumber + 1);
validateandupdate(newslots, true);
public void addLocalComm(long machineId, LocalComm lc) {
localCommunicationChannels.put(machineId, lc);
}
public void addLocalComm(long machineId, LocalComm lc) {
localCommunicationChannels.put(machineId, lc);
}
LocalComm lc = localCommunicationChannels.get(arb);
if (lc == null) {
// Cant talk directly to arbitrator so cant do anything
LocalComm lc = localCommunicationChannels.get(arb);
if (lc == null) {
// Cant talk directly to arbitrator so cant do anything
didCommitOrSpeculate |= createSpeculativeTable();
createPendingTransactionSpeculativeTable(didCommitOrSpeculate);
didCommitOrSpeculate |= createSpeculativeTable();
createPendingTransactionSpeculativeTable(didCommitOrSpeculate);
// Create a new transaction, invalidates any old pending transactions.
pendingTransBuild = new PendingTransaction();
}
// Create a new transaction, invalidates any old pending transactions.
pendingTransBuild = new PendingTransaction();
}
- if (tryput(keyName, machineId, false)) {
- // If successfully inserted
- return true;
+ if (tryput(keyName, machineId, false)) {
+ // If successfully inserted
+ mutex.release();
+ return true;
+ }
boolean doEnd = false;
boolean needResize = false;
while (!doEnd && ((uncommittedTransactionsMap.keySet().size() > 0) || (pendingCommitsList.size() > 0)) ) {
boolean doEnd = false;
boolean needResize = false;
while (!doEnd && ((uncommittedTransactionsMap.keySet().size() > 0) || (pendingCommitsList.size() > 0)) ) {
- private Pair<Boolean, List<Commit>> sendTransactionToLocal(Transaction ut, LocalComm lc) {
+ private Pair<Boolean, List<Commit>> sendTransactionToLocal(Transaction ut, LocalComm lc) throws InterruptedException {
// Do the local update and arbitrate
Pair<Boolean, List<Commit>> returnData = doLocalUpdateAndArbitrate(ut, lastSeenCommit);
// Do the local update and arbitrate
Pair<Boolean, List<Commit>> returnData = doLocalUpdateAndArbitrate(ut, lastSeenCommit);