[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645491#action_12645491
 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-204:
--------------------------------------------------

There is one point I don't understand. In the following:


{code:java}
@@ -702,6 +703,20 @@
             bb.putInt(bb.capacity() - 4);
             bb.rewind();
             synchronized (outgoingQueue) {
+                // We add backwards since we are pushing into the front
+                if (!disableAutoWatchReset) {
+                    SetWatches sw = new SetWatches(lastZxid,
+                            zooKeeper.getDataWatches(),
+                            zooKeeper.getExistWatches(),
+                            zooKeeper.getChildWatches());
+                    RequestHeader h = new RequestHeader();
+                    h.setType(ZooDefs.OpCode.setWatches);
+                    h.setXid(-8);
+                    Packet packet = new Packet(h, new ReplyHeader(), sw, null, 
null,
+                                null);
+                    outgoingQueue.add(packet);
+                }
+
{code}

>From the description of the jira, it sounds like you want to do 
>"outgoingQueue.addFirst(packet);" instead. Am I missing anything?

> SetWatches needs to be the first message after auth messages to the server
> --------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-204
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-204
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>    Affects Versions: 3.0.0
>            Reporter: Benjamin Reed
>            Assignee: Benjamin Reed
>             Fix For: 3.0.1, 3.1.0
>
>         Attachments: ZOOKEEPER-204.patch, ZOOKEEPER-204.patch
>
>
> When the ZooKeeper java client  makes a connection it queues a SetWatches  
> request. The problem is that it puts the request at the end of the outgoing 
> requests. This means that watches for requests that were queued before the 
> connection is made and after the disconnect may improperly get their watches 
> triggered.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to