Repository: flex-blazeds
Updated Branches:
  refs/heads/develop 43f1b956a -> a6a313f4e


#2 - Fixed bug with flushing messages to polling client.
 - Applied suggested changes

 Even if I can't 100 percent confirm that the changes do what the patch should 
do, it does look suspicious that the first message in the queue seems to force 
the throttling rules, with this patch this should make a little more sense.


Project: http://git-wip-us.apache.org/repos/asf/flex-blazeds/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-blazeds/commit/20346175
Tree: http://git-wip-us.apache.org/repos/asf/flex-blazeds/tree/20346175
Diff: http://git-wip-us.apache.org/repos/asf/flex-blazeds/diff/20346175

Branch: refs/heads/develop
Commit: 2034617524139e23e920b8ce60bffae20d13cbee
Parents: bf2e1dc
Author: Christofer Dutz <[email protected]>
Authored: Sun Mar 13 18:18:28 2016 +0100
Committer: Christofer Dutz <[email protected]>
Committed: Sun Mar 13 18:18:28 2016 +0100

----------------------------------------------------------------------
 .../client/FlexClientOutboundQueueProcessor.java  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/20346175/core/src/flex/messaging/client/FlexClientOutboundQueueProcessor.java
----------------------------------------------------------------------
diff --git 
a/core/src/flex/messaging/client/FlexClientOutboundQueueProcessor.java 
b/core/src/flex/messaging/client/FlexClientOutboundQueueProcessor.java
index 19cf19e..71a5c7e 100644
--- a/core/src/flex/messaging/client/FlexClientOutboundQueueProcessor.java
+++ b/core/src/flex/messaging/client/FlexClientOutboundQueueProcessor.java
@@ -194,21 +194,25 @@ public class FlexClientOutboundQueueProcessor
                     continue;
                 }
 
-                messageClient = messageClient == null? 
getMessageClient(message) : messageClient;
+                // If no message client was explicitly provided, get the 
message client from
+                // the current message.
+                MessageClient messageClientForCurrentMessage = messageClient 
== null ?
+                        getMessageClient(message) : messageClient;
 
                 // First, apply the destination level outbound throttling.
-                ThrottleResult throttleResult = 
throttleOutgoingDestinationLevel(messageClient, message, false);
+                ThrottleResult throttleResult =
+                        
throttleOutgoingDestinationLevel(messageClientForCurrentMessage, message, 
false);
                 Result result = throttleResult.getResult();
 
                 // No destination level throttling; check destination-client 
level throttling.
                 if (Result.OK == result)
                 {
-                    throttleResult = 
throttleOutgoingClientLevel(messageClient, message, false);
+                    throttleResult = 
throttleOutgoingClientLevel(messageClientForCurrentMessage, message, false);
                     result = throttleResult.getResult();
                     // If no throttling, simply add the message to the list.
                     if (Result.OK == result)
                     {
-                        updateMessageFrequencyOutgoing(messageClient, message);
+                        
updateMessageFrequencyOutgoing(messageClientForCurrentMessage, message);
                         if (messagesToFlush == null)
                             messagesToFlush = new ArrayList<Message>();
                         messagesToFlush.add(message);
@@ -238,7 +242,8 @@ public class FlexClientOutboundQueueProcessor
      */
     public boolean isMessageExpired(Message message)
     {
-        return (message.getTimeToLive() > 0 && (System.currentTimeMillis() - 
message.getTimestamp()) >= message.getTimeToLive());
+        return (message.getTimeToLive() > 0 &&
+                (System.currentTimeMillis() - message.getTimestamp()) >= 
message.getTimeToLive());
     }
 
     /**
@@ -250,7 +255,8 @@ public class FlexClientOutboundQueueProcessor
      * parts of regular throttling code is skipped.
      * @return The result of throttling attempt.
      */
-    protected ThrottleResult throttleOutgoingDestinationLevel(MessageClient 
msgClient, Message message, boolean buffered)
+    protected ThrottleResult throttleOutgoingDestinationLevel(
+            MessageClient msgClient, Message message, boolean buffered)
     {
         ThrottleManager throttleManager = getThrottleManager(msgClient);
         if (throttleManager != null)

Reply via email to