public void Test14(ref int op) { Console.WriteLine("Test 14: Testing 1000 puts and 1 get with 1000 " + "results with the same key. Then we remove the main owner of the " + "key."); RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); byte[] key = new byte[10]; byte[] value = new byte[value_size]; rng.GetBytes(key); ArrayList al_results = new ArrayList(); int count = 60; BlockingQueue[] results_queue = new BlockingQueue[count]; for (int i = 0; i < count; i++) { value = new byte[value_size]; rng.GetBytes(value); al_results.Add(value); results_queue[i] = new BlockingQueue(); default_dht.AsyncPut(key, value, 3000, results_queue[i]); } for (int i = 0; i < count; i++) { try { bool res = (bool)results_queue[i].Dequeue(); Console.WriteLine("success in put : " + i); } catch { Console.WriteLine("Failure in put : " + i); } } Console.WriteLine("Insertion done..."); Console.WriteLine("Disconnecting nodes..."); MemBlock[] b = default_dht.MapToRing(key); BigInteger[] baddrs = new BigInteger[default_dht.DEGREE]; BigInteger[] addrs = new BigInteger[default_dht.DEGREE]; bool first_run = true; foreach (DictionaryEntry de in nodes) { Address addr = (Address)de.Key; for (int j = 0; j < b.Length; j++) { if (first_run) { addrs[j] = addr.ToBigInteger(); baddrs[j] = (new AHAddress(b[j])).ToBigInteger(); } else { BigInteger caddr = addr.ToBigInteger(); BigInteger new_diff = baddrs[j] - caddr; if (new_diff < 0) { new_diff *= -1; } BigInteger c_diff = baddrs[j] - addrs[j]; if (c_diff < 0) { c_diff *= -1; } if (c_diff > new_diff) { addrs[j] = caddr; } } } first_run = false; } for (int i = 0; i < addrs.Length; i++) { Console.WriteLine(new AHAddress(baddrs[i]) + " " + new AHAddress(addrs[i])); Address laddr = new AHAddress(addrs[i]); Node node = (Node)nodes[laddr]; node.Disconnect(); nodes.Remove(laddr); tables.Remove(laddr); network_size--; } default_dht = new Dht((Node)nodes.GetByIndex(0), degree); // Checking the ring every 5 seconds.. do { Thread.Sleep(5000); }while(!CheckAllConnections()); Console.WriteLine("Going to sleep now..."); Thread.Sleep(15000); Console.WriteLine("Timeout done.... now attempting gets"); this.SerialAsyncGet(key, (byte[][])al_results.ToArray(typeof(byte[])), op++); Thread.Sleep(5000); Console.WriteLine("This checks to make sure our follow up Puts succeeded"); this.SerialAsyncGet(key, (byte[][])al_results.ToArray(typeof(byte[])), op++); Console.WriteLine("If no error messages successful up to: " + (op - 1)); foreach (TableServer ts in tables.Values) { Console.WriteLine("Count ... " + ts.Count); } }