edit
authorbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 01:50:30 +0000 (17:50 -0800)
committerbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 01:50:30 +0000 (17:50 -0800)
version2/src/C/Commit.cc
version2/src/C/Table.cc
version2/src/C/Table.h
version2/src/C/Transaction.cc
version2/src/C/Transaction.h

index 32e21756ce1846d5fa78f7f65f21548ab1c70b1c..5c616920726d5a8fbedd163ce5e9b517935ec405 100644 (file)
@@ -1,7 +1,7 @@
 #include "commit.h"
 
 Commit::Commit() :
-       parts(new HashMap<int32_t, CommitPart *>()),
+       parts(new Hashtable<int32_t, CommitPart *>()),
        missingParts(NULL),
        fldisComplete(false),
        hasLastPart(false),
@@ -15,7 +15,7 @@ Commit::Commit() :
 
 
 Commit::Commit(int64_t _sequenceNumber, int64_t _machineId, int64_t _transactionSequenceNumber) :
-       parts(new HashMap<int32_t, CommitPart *>()),
+       parts(new Hashtable<int32_t, CommitPart *>()),
        missingParts(NULL),
        fldisComplete(true),
        hasLastPart(false),
@@ -81,7 +81,7 @@ void Commit::addPartDecode(CommitPart newPart) {
         return transactionSequenceNumber;
     }
 
-    Map<Integer, CommitPart> getParts() {
+    Hashtable<Integer, CommitPart> getParts() {
         return parts;
     }
 
@@ -218,7 +218,7 @@ int32_t getNumberOfParts() {
         return bbEncode.array();
     }
 
-    void setKVsMap(Map<IoTString, KeyValue> newKVs) {
+    void setKVsMap(Hashtable<IoTString, KeyValue> newKVs) {
         keyValueUpdateSet.clear();
         liveKeys.clear();
 
@@ -236,7 +236,7 @@ int32_t getNumberOfParts() {
             return older;
         }
 
-        Map<IoTString, KeyValue> kvSet = new HashMap<IoTString, KeyValue>();
+        Hashtable<IoTString, KeyValue> kvSet = new Hashtable<IoTString, KeyValue>();
         for (KeyValue kv : older.getKeyValueUpdateSet()) {
             kvSet.put(kv.getKey(), kv);
         }
index 07923d58fc2ca67852265a3928340e58e713791f..0a70459dfb16688895694441cac3c8739df9e637 100644 (file)
@@ -48,39 +48,39 @@ final class Table {
        Slot lastSlotAttemptedToSend = NULL;
        bool lastIsNewKey = false;
        int lastNewSize = 0;
-       Map<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
+       Hashtable<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
        List<Entry> lastPendingSendArbitrationEntriesToDelete = NULL;
        NewKey lastNewKey = NULL;
 
 
        /* Data Structures  */
-       Map<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
-       Map<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
-       Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
-       Map<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
-       HashMap<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
-       HashMap<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
-       Map<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
-       Map<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
-       Map<Long, Map<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
-       Map<Long, Map<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
-       Map<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
-       Map<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
-       Map<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
-       Map<Long, Map<Long, Commit>> liveCommitsTable = NULL;
-       Map<IoTString, Commit> liveCommitsByKeyTable = NULL;
-       Map<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
+       Hashtable<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
+       Hashtable<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
+       Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
+       Hashtable<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
+       Hashtable<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
+       Hashtable<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
+       Hashtable<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
+       Hashtable<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
+       Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
+       Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
+       Hashtable<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
+       Hashtable<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
+       Hashtable<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
+       Hashtable<Long, Hashtable<Long, Commit>> liveCommitsTable = NULL;
+       Hashtable<IoTString, Commit> liveCommitsByKeyTable = NULL;
+       Hashtable<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
        Vector<Long> rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server
        List<Transaction> pendingTransactionQueue = NULL;
        List<ArbitrationRound> pendingSendArbitrationRounds = NULL;
        List<Entry> pendingSendArbitrationEntriesToDelete = NULL;
-       Map<Transaction, List<Integer>> transactionPartsSent = NULL;
-       Map<Long, TransactionStatus> outstandingTransactionStatus = NULL;
-       Map<Long, Abort> liveAbortsGeneratedByLocal = NULL;
+       Hashtable<Transaction, List<Integer>> transactionPartsSent = NULL;
+       Hashtable<Long, TransactionStatus> outstandingTransactionStatus = NULL;
+       Hashtable<Long, Abort> liveAbortsGeneratedByLocal = NULL;
        Set<Pair<int64_t, int64_t>> offlineTransactionsCommittedAndAtServer = NULL;
-       Map<Long, Pair<String, Integer>> localCommunicationTable = NULL;
-       Map<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
-       Map<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
+       Hashtable<Long, Pair<String, Integer>> localCommunicationTable = NULL;
+       Hashtable<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
+       Hashtable<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
 
 
        Table(String baseurl, String password, int64_t _localMachineId, int listeningPort) {
@@ -110,33 +110,33 @@ final class Table {
                oldestLiveSlotSequenceNumver = 1;
 
                // init data structs
-               committedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               speculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               pendingTransactionSpeculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               liveNewKeyTable = new HashMap<IoTString, NewKey>();
-               lastMessageTable = new HashMap<Long, Pair<Long, Liveness>>();
-               rejectedMessageWatchListTable = new HashMap<Long, HashSet<RejectedMessage>>();
-               arbitratorTable = new HashMap<IoTString, Long>();
-               liveAbortTable = new HashMap<Pair<int64_t, int64_t>, Abort>();
-               newTransactionParts = new HashMap<Long, Map<Pair<Long, Integer>, TransactionPart>>();
-               newCommitParts = new HashMap<Long, Map<Pair<Long, Integer>, CommitPart>>();
-               lastArbitratedTransactionNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
-               liveTransactionBySequenceNumberTable = new HashMap<Long, Transaction>();
-               liveTransactionByTransactionIdTable = new HashMap<Pair<int64_t, int64_t>, Transaction>();
-               liveCommitsTable = new HashMap<Long, Map<Long, Commit>>();
-               liveCommitsByKeyTable = new HashMap<IoTString, Commit>();
-               lastCommitSeenSequenceNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
+               committedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               speculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               pendingTransactionSpeculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               liveNewKeyTable = new Hashtable<IoTString, NewKey>();
+               lastMessageTable = new Hashtable<Long, Pair<Long, Liveness>>();
+               rejectedMessageWatchListTable = new Hashtable<Long, HashSet<RejectedMessage>>();
+               arbitratorTable = new Hashtable<IoTString, Long>();
+               liveAbortTable = new Hashtable<Pair<int64_t, int64_t>, Abort>();
+               newTransactionParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>>();
+               newCommitParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>>();
+               lastArbitratedTransactionNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
+               liveTransactionBySequenceNumberTable = new Hashtable<Long, Transaction>();
+               liveTransactionByTransactionIdTable = new Hashtable<Pair<int64_t, int64_t>, Transaction>();
+               liveCommitsTable = new Hashtable<Long, Hashtable<Long, Commit>>();
+               liveCommitsByKeyTable = new Hashtable<IoTString, Commit>();
+               lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
                rejectedSlotList = new Vector<Long>();
                pendingTransactionQueue = new ArrayList<Transaction>();
                pendingSendArbitrationEntriesToDelete = new ArrayList<Entry>();
-               transactionPartsSent = new HashMap<Transaction, List<Integer>>();
-               outstandingTransactionStatus = new HashMap<Long, TransactionStatus>();
-               liveAbortsGeneratedByLocal = new HashMap<Long, Abort>();
+               transactionPartsSent = new Hashtable<Transaction, List<Integer>>();
+               outstandingTransactionStatus = new Hashtable<Long, TransactionStatus>();
+               liveAbortsGeneratedByLocal = new Hashtable<Long, Abort>();
                offlineTransactionsCommittedAndAtServer = new HashSet<Pair<int64_t, int64_t>>();
-               localCommunicationTable = new HashMap<Long, Pair<String, Integer>>();
-               lastTransactionSeenFromMachineFromServer = new HashMap<int64_t, int64_t>();
+               localCommunicationTable = new Hashtable<Long, Pair<String, Integer>>();
+               lastTransactionSeenFromMachineFromServer = new Hashtable<int64_t, int64_t>();
                pendingSendArbitrationRounds = new ArrayList<ArbitrationRound>();
-               lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new HashMap<int64_t, int64_t>();
+               lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new Hashtable<int64_t, int64_t>();
 
 
                // Other init stuff
@@ -761,7 +761,7 @@ final class Table {
                                lastInsertedNewKey = insertedNewKey;
                                lastNewSize = newSize;
                                lastNewKey = newKey;
-                               lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+                               lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
                                lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
 
 
@@ -880,7 +880,7 @@ final class Table {
 
 
                                // if (!fromRetry) {
-                               //      lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+                               //      lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
                                //      lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
                                // }
 
@@ -1089,7 +1089,7 @@ final class Table {
                }
 
                // Get the commits to send back
-               Map<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
+               Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
                if (commitForClientTable != NULL) {
                        List<Long> commitLocalSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
                        Collections.sort(commitLocalSequenceNumbers);
@@ -1626,7 +1626,7 @@ final class Table {
 
                // Iterate through all the machine Ids that we received new parts for
                for (Long machineId : newTransactionParts.keySet()) {
-                       Map<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
+                       Hashtable<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
 
                        // Iterate through all the parts for that machine Id
                        for (Pair<Long, Integer> partId : parts.keySet()) {
@@ -1675,7 +1675,7 @@ final class Table {
                Collections.sort(transactionSequenceNumbers);
 
                // Collection of key value pairs that are
-               Map<IoTString, KeyValue> speculativeTableTmp = new HashMap<IoTString, KeyValue>();
+               Hashtable<IoTString, KeyValue> speculativeTableTmp = new Hashtable<IoTString, KeyValue>();
 
                // The last transaction arbitrated on
                int64_t lastTransactionCommitted = -1;
@@ -2000,18 +2000,18 @@ final class Table {
 
                // Iterate through all the machine Ids that we received new parts for
                for (Long machineId : newCommitParts.keySet()) {
-                       Map<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
+                       Hashtable<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
 
                        // Iterate through all the parts for that machine Id
                        for (Pair<Long, Integer> partId : parts.keySet()) {
                                CommitPart part = parts.get(partId);
 
                                // Get the transaction object for that sequence number
-                               Map<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
+                               Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
 
                                if (commitForClientTable == NULL) {
                                        // This is the first commit from this device
-                                       commitForClientTable = new HashMap<Long, Commit>();
+                                       commitForClientTable = new Hashtable<Long, Commit>();
                                        liveCommitsTable.put(part.getMachineId(), commitForClientTable);
                                }
 
@@ -2040,7 +2040,7 @@ final class Table {
                for (Long arbitratorId : liveCommitsTable.keySet()) {
 
                        // Get all the commits for a specific arbitrator
-                       Map<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
+                       Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
 
                        // Sort the commits in order
                        List<Long> commitSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
@@ -2553,11 +2553,11 @@ final class Table {
                }
 
                // This part is still alive
-               Map<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
+               Hashtable<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
 
                if (transactionPart == NULL) {
                        // Dont have a table for this machine Id yet so make one
-                       transactionPart = new HashMap<Pair<Long, Integer>, TransactionPart>();
+                       transactionPart = new Hashtable<Pair<Long, Integer>, TransactionPart>();
                        newTransactionParts.put(entry.getMachineId(), transactionPart);
                }
 
@@ -2587,11 +2587,11 @@ final class Table {
 
 
 
-               Map<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
+               Hashtable<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
 
                if (commitPart == NULL) {
                        // Don't have a table for this machine Id yet so make one
-                       commitPart = new HashMap<Pair<Long, Integer>, CommitPart>();
+                       commitPart = new Hashtable<Pair<Long, Integer>, CommitPart>();
                        newCommitParts.put(entry.getMachineId(), commitPart);
                }
 
index 4a6fe5604d0665ddf25e39d03222a8bafd238dd0..b3e2d0ecc183bb9bf9d83073af96fde59ae2cb7f 100644 (file)
@@ -48,39 +48,39 @@ final public class Table {
        private Slot lastSlotAttemptedToSend = NULL;
        private bool lastIsNewKey = false;
        private int lastNewSize = 0;
-       private Map<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
+       private Hashtable<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
        private List<Entry> lastPendingSendArbitrationEntriesToDelete = NULL;
        private NewKey lastNewKey = NULL;
 
 
        /* Data Structures  */
-       private Map<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
-       private Map<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
-       private Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
-       private Map<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
-       private HashMap<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
-       private HashMap<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
-       private Map<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
-       private Map<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
-       private Map<Long, Map<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
-       private Map<Long, Map<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
-       private Map<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
-       private Map<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
-       private Map<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
-       private Map<Long, Map<Long, Commit>> liveCommitsTable = NULL;
-       private Map<IoTString, Commit> liveCommitsByKeyTable = NULL;
-       private Map<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
+       private Hashtable<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
+       private Hashtable<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
+       private Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
+       private Hashtable<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
+       private Hashtable<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
+       private Hashtable<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
+       private Hashtable<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
+       private Hashtable<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
+       private Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
+       private Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
+       private Hashtable<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
+       private Hashtable<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
+       private Hashtable<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
+       private Hashtable<Long, Hashtable<Long, Commit>> liveCommitsTable = NULL;
+       private Hashtable<IoTString, Commit> liveCommitsByKeyTable = NULL;
+       private Hashtable<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
        private Vector<Long> rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server
        private List<Transaction> pendingTransactionQueue = NULL;
        private List<ArbitrationRound> pendingSendArbitrationRounds = NULL;
        private List<Entry> pendingSendArbitrationEntriesToDelete = NULL;
-       private Map<Transaction, List<Integer>> transactionPartsSent = NULL;
-       private Map<Long, TransactionStatus> outstandingTransactionStatus = NULL;
-       private Map<Long, Abort> liveAbortsGeneratedByLocal = NULL;
+       private Hashtable<Transaction, List<Integer>> transactionPartsSent = NULL;
+       private Hashtable<Long, TransactionStatus> outstandingTransactionStatus = NULL;
+       private Hashtable<Long, Abort> liveAbortsGeneratedByLocal = NULL;
        private Set<Pair<int64_t, int64_t>> offlineTransactionsCommittedAndAtServer = NULL;
-       private Map<Long, Pair<String, Integer>> localCommunicationTable = NULL;
-       private Map<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
-       private Map<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
+       private Hashtable<Long, Pair<String, Integer>> localCommunicationTable = NULL;
+       private Hashtable<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
+       private Hashtable<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
 
 
        public Table(String baseurl, String password, int64_t _localMachineId, int listeningPort) {
@@ -110,33 +110,33 @@ final public class Table {
                oldestLiveSlotSequenceNumver = 1;
 
                // init data structs
-               committedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               speculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               pendingTransactionSpeculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
-               liveNewKeyTable = new HashMap<IoTString, NewKey>();
-               lastMessageTable = new HashMap<Long, Pair<Long, Liveness>>();
-               rejectedMessageWatchListTable = new HashMap<Long, HashSet<RejectedMessage>>();
-               arbitratorTable = new HashMap<IoTString, Long>();
-               liveAbortTable = new HashMap<Pair<int64_t, int64_t>, Abort>();
-               newTransactionParts = new HashMap<Long, Map<Pair<Long, Integer>, TransactionPart>>();
-               newCommitParts = new HashMap<Long, Map<Pair<Long, Integer>, CommitPart>>();
-               lastArbitratedTransactionNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
-               liveTransactionBySequenceNumberTable = new HashMap<Long, Transaction>();
-               liveTransactionByTransactionIdTable = new HashMap<Pair<int64_t, int64_t>, Transaction>();
-               liveCommitsTable = new HashMap<Long, Map<Long, Commit>>();
-               liveCommitsByKeyTable = new HashMap<IoTString, Commit>();
-               lastCommitSeenSequenceNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
+               committedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               speculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               pendingTransactionSpeculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+               liveNewKeyTable = new Hashtable<IoTString, NewKey>();
+               lastMessageTable = new Hashtable<Long, Pair<Long, Liveness>>();
+               rejectedMessageWatchListTable = new Hashtable<Long, HashSet<RejectedMessage>>();
+               arbitratorTable = new Hashtable<IoTString, Long>();
+               liveAbortTable = new Hashtable<Pair<int64_t, int64_t>, Abort>();
+               newTransactionParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>>();
+               newCommitParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>>();
+               lastArbitratedTransactionNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
+               liveTransactionBySequenceNumberTable = new Hashtable<Long, Transaction>();
+               liveTransactionByTransactionIdTable = new Hashtable<Pair<int64_t, int64_t>, Transaction>();
+               liveCommitsTable = new Hashtable<Long, Hashtable<Long, Commit>>();
+               liveCommitsByKeyTable = new Hashtable<IoTString, Commit>();
+               lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
                rejectedSlotList = new Vector<Long>();
                pendingTransactionQueue = new ArrayList<Transaction>();
                pendingSendArbitrationEntriesToDelete = new ArrayList<Entry>();
-               transactionPartsSent = new HashMap<Transaction, List<Integer>>();
-               outstandingTransactionStatus = new HashMap<Long, TransactionStatus>();
-               liveAbortsGeneratedByLocal = new HashMap<Long, Abort>();
+               transactionPartsSent = new Hashtable<Transaction, List<Integer>>();
+               outstandingTransactionStatus = new Hashtable<Long, TransactionStatus>();
+               liveAbortsGeneratedByLocal = new Hashtable<Long, Abort>();
                offlineTransactionsCommittedAndAtServer = new HashSet<Pair<int64_t, int64_t>>();
-               localCommunicationTable = new HashMap<Long, Pair<String, Integer>>();
-               lastTransactionSeenFromMachineFromServer = new HashMap<int64_t, int64_t>();
+               localCommunicationTable = new Hashtable<Long, Pair<String, Integer>>();
+               lastTransactionSeenFromMachineFromServer = new Hashtable<int64_t, int64_t>();
                pendingSendArbitrationRounds = new ArrayList<ArbitrationRound>();
-               lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new HashMap<int64_t, int64_t>();
+               lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new Hashtable<int64_t, int64_t>();
 
 
                // Other init stuff
@@ -761,7 +761,7 @@ final public class Table {
                                lastInsertedNewKey = insertedNewKey;
                                lastNewSize = newSize;
                                lastNewKey = newKey;
-                               lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+                               lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
                                lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
 
 
@@ -880,7 +880,7 @@ final public class Table {
 
 
                                // if (!fromRetry) {
-                               //      lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+                               //      lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
                                //      lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
                                // }
 
@@ -1089,7 +1089,7 @@ final public class Table {
                }
 
                // Get the commits to send back
-               Map<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
+               Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
                if (commitForClientTable != NULL) {
                        List<Long> commitLocalSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
                        Collections.sort(commitLocalSequenceNumbers);
@@ -1626,7 +1626,7 @@ final public class Table {
 
                // Iterate through all the machine Ids that we received new parts for
                for (Long machineId : newTransactionParts.keySet()) {
-                       Map<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
+                       Hashtable<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
 
                        // Iterate through all the parts for that machine Id
                        for (Pair<Long, Integer> partId : parts.keySet()) {
@@ -1675,7 +1675,7 @@ final public class Table {
                Collections.sort(transactionSequenceNumbers);
 
                // Collection of key value pairs that are
-               Map<IoTString, KeyValue> speculativeTableTmp = new HashMap<IoTString, KeyValue>();
+               Hashtable<IoTString, KeyValue> speculativeTableTmp = new Hashtable<IoTString, KeyValue>();
 
                // The last transaction arbitrated on
                int64_t lastTransactionCommitted = -1;
@@ -2000,18 +2000,18 @@ final public class Table {
 
                // Iterate through all the machine Ids that we received new parts for
                for (Long machineId : newCommitParts.keySet()) {
-                       Map<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
+                       Hashtable<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
 
                        // Iterate through all the parts for that machine Id
                        for (Pair<Long, Integer> partId : parts.keySet()) {
                                CommitPart part = parts.get(partId);
 
                                // Get the transaction object for that sequence number
-                               Map<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
+                               Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
 
                                if (commitForClientTable == NULL) {
                                        // This is the first commit from this device
-                                       commitForClientTable = new HashMap<Long, Commit>();
+                                       commitForClientTable = new Hashtable<Long, Commit>();
                                        liveCommitsTable.put(part.getMachineId(), commitForClientTable);
                                }
 
@@ -2040,7 +2040,7 @@ final public class Table {
                for (Long arbitratorId : liveCommitsTable.keySet()) {
 
                        // Get all the commits for a specific arbitrator
-                       Map<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
+                       Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
 
                        // Sort the commits in order
                        List<Long> commitSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
@@ -2553,11 +2553,11 @@ final public class Table {
                }
 
                // This part is still alive
-               Map<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
+               Hashtable<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
 
                if (transactionPart == NULL) {
                        // Dont have a table for this machine Id yet so make one
-                       transactionPart = new HashMap<Pair<Long, Integer>, TransactionPart>();
+                       transactionPart = new Hashtable<Pair<Long, Integer>, TransactionPart>();
                        newTransactionParts.put(entry.getMachineId(), transactionPart);
                }
 
@@ -2587,11 +2587,11 @@ final public class Table {
 
 
 
-               Map<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
+               Hashtable<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
 
                if (commitPart == NULL) {
                        // Don't have a table for this machine Id yet so make one
-                       commitPart = new HashMap<Pair<Long, Integer>, CommitPart>();
+                       commitPart = new Hashtable<Pair<Long, Integer>, CommitPart>();
                        newCommitParts.put(entry.getMachineId(), commitPart);
                }
 
index 00d0882c5da034996ffedb134410e1525500e6f1..532d6e571e0b81e16457755af8f29ffcfb2ac83c 100644 (file)
@@ -2,7 +2,7 @@
 
 class Transaction {
 
-    Map<Integer, TransactionPart> parts = NULL;
+    Hashtable<Integer, TransactionPart> parts = NULL;
     Set<Integer> missingParts = NULL;
     List<Integer> partsPendingSend = NULL;
     bool isComplete = false;
@@ -24,7 +24,7 @@ class Transaction {
     bool hadServerFailure = false;
 
     Transaction() {
-        parts = new HashMap<Integer, TransactionPart>();
+        parts = new Hashtable<Integer, TransactionPart>();
         keyValueGuardSet = new HashSet<KeyValue>();
         keyValueUpdateSet = new HashSet<KeyValue>();
         partsPendingSend = new ArrayList<Integer>();
@@ -115,7 +115,7 @@ class Transaction {
         return clientLocalSequenceNumber;
     }
 
-    Map<Integer, TransactionPart> getParts() {
+    Hashtable<Integer, TransactionPart> getParts() {
         return parts;
     }
 
@@ -255,7 +255,7 @@ class Transaction {
         }
     }
 
-    bool evaluateGuard(Map<IoTString, KeyValue> committedKeyValueTable, Map<IoTString, KeyValue> speculatedKeyValueTable, Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
+    bool evaluateGuard(Hashtable<IoTString, KeyValue> committedKeyValueTable, Hashtable<IoTString, KeyValue> speculatedKeyValueTable, Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
         for (KeyValue kvGuard : keyValueGuardSet) {
 
             // First check if the key is in the speculative table, this is the value of the latest assumption
index f5a5bfdc2c3ceef1402c5cc2e415648b83f29346..d59f71046ee0a551c144e2a7b63c1b960614a9e7 100644 (file)
@@ -26,7 +26,7 @@ class Transaction {
  bool hadServerFailure = false;
 
     public Transaction() {
-        parts = new HashMap<Integer, TransactionPart>();
+        parts = new Hashtable<Integer, TransactionPart>();
         keyValueGuardSet = new HashSet<KeyValue>();
         keyValueUpdateSet = new HashSet<KeyValue>();
         partsPendingSend = new ArrayList<Integer>();
@@ -117,7 +117,7 @@ class Transaction {
         return clientLocalSequenceNumber;
     }
 
-    public Map<Integer, TransactionPart> getParts() {
+    public Hashtable<Integer, TransactionPart> getParts() {
         return parts;
     }
 
@@ -257,7 +257,7 @@ class Transaction {
         }
     }
 
-    public bool evaluateGuard(Map<IoTString, KeyValue> committedKeyValueTable, Map<IoTString, KeyValue> speculatedKeyValueTable, Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
+    public bool evaluateGuard(Hashtable<IoTString, KeyValue> committedKeyValueTable, Hashtable<IoTString, KeyValue> speculatedKeyValueTable, Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
         for (KeyValue kvGuard : keyValueGuardSet) {
 
             // First check if the key is in the speculative table, this is the value of the latest assumption