DESCRIPTION

JVMCBC-299: Avoid Node[] allocations on the send path.

Motivation
----------
The Locators pick the right Nodes and return them as a Node[] which
in return gets iterated again and the requests send to each node.

Modifications
-------------
This changeset moves the responsibility of sending into the locators,
which has two benefits:

 - No Node[] allocations since nothing needs to be signalled back.
 - The code doesn't need to iterate through the list again, which is 99%
   of the time exactly 1 element.

Since the code itself is not complex, there is not a performance increase
visible but it cleans up the code a bit and more imporantly saves allocations
on every request.

As a side effect, the test case assertions look much nicer now, since we
can explicitly check which node is called on send().

In a 5 minute run with JMH with 10k ops/s, this saved around 100MB of
allocs.

Result
------
Less allocations on the hot code path.

Change-Id: I12e2bacda95b494abb01b8f3533638eb49974f46


COMMENTS

author: Natasha Sullivan
date: 2016-03-03 09:10:47.284000000

Uploaded patch set 2: Commit message was updated.

-------------------------------------
author: Natasha Sullivan
date: 2016-03-03 09:11:24.052000000

Patch Set 2: Verified+1

-------------------------------------
author: Cory Peck
date: 2016-03-03 09:23:24.457000000

Patch Set 2: Code-Review+2

-------------------------------------
author: Estrella Humphrey
date: 2016-03-03 10:01:40.425000000

Patch Set 2: Code-Review-1

(2 comments)

Line:34, src/main/java/com/couchbase/client/core/node/locate/Locator.java -> this could be renamed "dispatch", or made deprecated and a new "dispatch" method added if we don't want to break a public interface

Line:296, src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java -> I would keep that out of this method, and instead do the retryOrCancel in the if block above (line 277), as this is a side effect and the method could be reused later on, not expecting a retry to be scheduled

-------------------------------------
author: Gerrit Code Review
date: 2016-03-03 11:24:01.878000000

Change has been successfully cherry-picked as 72b6a7b091fbc76caaac5f869fe9cd7e5f8785f2

-------------------------------------
