Updated Branches:
  refs/heads/trunk 7af7eb31e -> 9c80f37d5

rename Entry -> QueuedMessage


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9c80f37d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9c80f37d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9c80f37d

Branch: refs/heads/trunk
Commit: 9c80f37d5eb3ec505341347631a430ffc03b0071
Parents: 7af7eb3
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Mon Sep 3 10:36:56 2012 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Mon Sep 3 10:36:56 2012 -0500

----------------------------------------------------------------------
 .../cassandra/net/OutboundTcpConnection.java       |   26 +++++++-------
 1 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9c80f37d/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java 
b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
index 24f4555..5572162 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
@@ -46,8 +46,8 @@ public class OutboundTcpConnection extends Thread
 
     // sending thread reads from "active" (one of queue1, queue2) until it is 
empty.
     // then it swaps it with "backlog."
-    private volatile BlockingQueue<Entry> backlog = new 
LinkedBlockingQueue<Entry>();
-    private volatile BlockingQueue<Entry> active = new 
LinkedBlockingQueue<Entry>();
+    private volatile BlockingQueue<QueuedMessage> backlog = new 
LinkedBlockingQueue<QueuedMessage>();
+    private volatile BlockingQueue<QueuedMessage> active = new 
LinkedBlockingQueue<QueuedMessage>();
 
     private final OutboundTcpConnectionPool poolReference;
 
@@ -75,7 +75,7 @@ public class OutboundTcpConnection extends Thread
         expireMessages();
         try
         {
-            backlog.put(new Entry(message, id, System.currentTimeMillis()));
+            backlog.put(new QueuedMessage(message, id, 
System.currentTimeMillis()));
         }
         catch (InterruptedException e)
         {
@@ -104,7 +104,7 @@ public class OutboundTcpConnection extends Thread
     {
         while (true)
         {
-            Entry entry = active.poll();
+            QueuedMessage entry = active.poll();
             if (entry == null)
             {
                 // exhausted the active queue.  switch to backlog, once 
there's something to process there
@@ -117,7 +117,7 @@ public class OutboundTcpConnection extends Thread
                     throw new AssertionError(e);
                 }
 
-                BlockingQueue<Entry> tmp = backlog;
+                BlockingQueue<QueuedMessage> tmp = backlog;
                 backlog = active;
                 active = tmp;
             }
@@ -309,18 +309,18 @@ public class OutboundTcpConnection extends Thread
     {
         while (true)
         {
-            Entry entry = backlog.peek();
-            if (entry == null || entry.timestamp >= System.currentTimeMillis() 
- entry.message.getTimeout())
+            QueuedMessage message = backlog.peek();
+            if (message == null || message.timestamp >= 
System.currentTimeMillis() - message.message.getTimeout())
                 break;
 
-            Entry entry2 = backlog.poll();
-            if (entry2 != entry)
+            QueuedMessage message2 = backlog.poll();
+            if (message2 != message)
             {
                 // sending thread switched queues.  add this entry (from the 
"new" backlog)
                 // at the end of the active queue, which keeps it in the same 
position relative to the other entries
                 // without having to contend with other clients for the 
head-of-backlog lock.
-                if (entry2 != null)
-                    active.add(entry2);
+                if (message2 != null)
+                    active.add(message2);
                 break;
             }
 
@@ -328,13 +328,13 @@ public class OutboundTcpConnection extends Thread
         }
     }
 
-    private static class Entry
+    private static class QueuedMessage
     {
         final MessageOut<?> message;
         final String id;
         final long timestamp;
 
-        Entry(MessageOut<?> message, String id, long timestamp)
+        QueuedMessage(MessageOut<?> message, String id, long timestamp)
         {
             this.message = message;
             this.id = id;

Reply via email to