Timing, Attacks
[iotcloud.git] / version2 / src / java / iotcloud / Table.java
index 225d25fc263dfc6da74e85f33c794243355f8315..59a12f4207a2858b580dd1d277c25419e631fc11 100644 (file)
@@ -364,6 +364,10 @@ final public class Table {
                        return true;
                } catch (Exception e) {
                        // e.printStackTrace();
+
+                       for (Long m : localCommunicationTable.keySet()) {
+                               updateFromLocal(m);
+                       }
                }
 
                return false;
@@ -698,7 +702,6 @@ final public class Table {
 
                                // If there is a new key with same name then end
                                if ((newKey != null) && (arbitratorTable.get(newKey.getKey()) != null)) {
-                                       System.out.println("New Key Fail");
                                        return false;
                                }
 
@@ -779,10 +782,6 @@ final public class Table {
                                                if (transaction.didSendAllParts()) {
                                                        transaction.getTransactionStatus().setStatus(TransactionStatus.StatusSentFully);
                                                        pendingTransactionQueue.remove(transaction);
-
-                                                       for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
-                                                               System.out.println("Sent: " + kv + "  from: " + localMachineId + "   Slot:" + slot.getSequenceNumber() + "  Claimed:" + transaction.getSequenceNumber());
-                                                       }
                                                }
                                        }
                                } else {
@@ -840,13 +839,6 @@ final public class Table {
 
                } catch (ServerException e) {
 
-                       System.out.println("Server Failure:   " + e.getType());
-                       for (Transaction transaction : transactionPartsSent.keySet()) {
-                               for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
-                                       System.out.println("Sent Error: " + kv + "    " + e.getType());
-                               }
-                       }
-
                        if (e.getType() != ServerException.TypeInputTimeout) {
                                // e.printStackTrace();
 
@@ -885,7 +877,7 @@ final public class Table {
                return newKey == null;
        }
 
-       public synchronized boolean updateFromLocal(long machineId) {
+       private synchronized boolean updateFromLocal(long machineId) {
                Pair<String, Integer> localCommunicationInformation = localCommunicationTable.get(machineId);
                if (localCommunicationInformation == null) {
                        // Cant talk to that device locally so do nothing
@@ -1645,9 +1637,6 @@ final public class Table {
                for (Long transactionSequenceNumber : transactionSequenceNumbers) {
                        Transaction transaction = liveTransactionBySequenceNumberTable.get(transactionSequenceNumber);
 
-                       for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
-                               System.out.println("Arb Seen: " + kv + "   " + lastSeqNumArbOn + "    " + transactionSequenceNumber + "  " + localMachineId + "   " + transaction.getArbitrator());
-                       }
 
 
                        // Check if this machine arbitrates for this transaction if not then we cant arbitrate this transaction
@@ -1659,11 +1648,6 @@ final public class Table {
                                continue;
                        }
 
-                       for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
-                               System.out.println("Arb Seen: " + kv + "   " + lastSeqNumArbOn + "    " + transactionSequenceNumber + "  " + localMachineId);
-                       }
-
-
                        if (offlineTransactionsCommittedAndAtServer.contains(transaction.getId())) {
                                // We have seen this already locally so dont commit again
                                continue;
@@ -1676,10 +1660,6 @@ final public class Table {
                                break;
                        }
 
-                       for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
-                               System.out.println("Arb on: " + kv + "   " + lastSeqNumArbOn + "    " + transactionSequenceNumber + "  " + localMachineId);
-                       }
-
 
                        // update the largest transaction seen by arbitrator from server
                        if (lastTransactionSeenFromMachineFromServer.get(transaction.getMachineId()) == null) {
@@ -1701,8 +1681,6 @@ final public class Table {
 
                                // Update what the last transaction committed was for use in batch commit
                                lastTransactionCommitted = transactionSequenceNumber;
-
-                               System.out.println("Commit Generated: " + lastTransactionCommitted + "   " + localMachineId);
                        } else {
                                // Guard evaluated was false so create abort
 
@@ -2056,20 +2034,6 @@ final public class Table {
                                        }
                                }
 
-
-                               for (KeyValue kv : commit.getKeyValueUpdateSet()) {
-                                       System.out.println("Commit Seen: " + kv + "   " + commit.getTransactionSequenceNumber() + "   " + localMachineId);
-                               }
-
-
-
-
-
-
-
-
-
-
                                // Update the last arbitration data that we have seen so far
                                if (lastArbitrationDataLocalSequenceNumberSeenFromArbitrator.get(commit.getMachineId()) != null) {