DESCRIPTION

JCBC-390: Refactor ClusterManager

The ClusterManager needs to be refactored because the HttpCore dependency
has been upgraded. While the old code would still work, getting rid of
the deprecated pieces makes sense to keep the code consistent with the
view logic.

Change-Id: I2df6e086b9911fb1a50a6d2ab08239cbf4c6a342


COMMENTS

author: Natasha Sullivan
date: 2013-12-19 12:26:54.645000000

Uploaded patch set 3.

-------------------------------------
author: Yasmin Rush
date: 2013-12-20 06:38:33.792000000

Patch Set 3: Code-Review+1

-------------------------------------
author: Andreas Short
date: 2013-12-29 02:22:17.603000000

Patch Set 3: Code-Review-2

(10 comments)

In the future, I don't really think it's useful for this class to maintain persistent connections.  Just a note that in 2.0, we should try to remove that.  There's a pretty high risk that people won't call the shutdown() and just leak resources.

It might be nice to add a finalizer just for the purposes of logging when misuse occurs.  It wouldn't obviously do much to help, but may help someone someday.

Line:153, src/main/java/com/couchbase/client/ClusterManager.java -> This comment is wrong.  We should fix it up while we're in here.

-2 for this.

Line:81, src/main/java/com/couchbase/client/ClusterManager.java -> boo.  URL construction.

Line:126, src/main/java/com/couchbase/client/ClusterManager.java -> It's not all nodes that are required, so you may want to clarify.

Line:154, src/main/java/com/couchbase/client/ClusterManager.java -> It'd be much better to have the specific version here and it's in another class, right?

-1 here

Line:161, src/main/java/com/couchbase/client/ClusterManager.java -> Boo.  Hard coded delays.  Not a big deal here I guess.

Line:183, src/main/java/com/couchbase/client/ClusterManager.java -> We should probably talk about this.  These "final" type things don't really help here.  Is it the IDE that's asking for them?  

They don't hurt, but they make it more to read.

Line:229, src/main/java/com/couchbase/client/ClusterManager.java -> I think the delete returns a 201, actually.

Line:318, src/main/java/com/couchbase/client/ClusterManager.java -> "whether"

Line:394, src/main/java/com/couchbase/client/ClusterManager.java -> Arguably we should try reconnecting, but not a big deal for this class.

Line:544, src/main/java/com/couchbase/client/ClusterManager.java -> Thread name is wrong.  -2 here.  Shows copy-n-paste coding.

-------------------------------------
author: Natasha Sullivan
date: 2013-12-30 05:54:47.488000000

Patch Set 3:

(8 comments)

Line:81, src/main/java/com/couchbase/client/ClusterManager.java -> I certainly understand that this would be much better - although I have to admit that this changeset was more or less just a update to the new httpcore version.. but I can try to get it in for sure :) .. we have the parsing extracted in a class anyway.

Line:126, src/main/java/com/couchbase/client/ClusterManager.java -> sounds good

Line:154, src/main/java/com/couchbase/client/ClusterManager.java -> Yeah I know we have the builder class, but I think this would be a separate task.. its generated at build time and not wired up correctly in our ant setup to be used in the main package IIRC - its only used for the jar cli commands.

Line:161, src/main/java/com/couchbase/client/ClusterManager.java -> I agree. We don't have a factory here though, we could add one.

Line:183, src/main/java/com/couchbase/client/ClusterManager.java -> Oh I just got into the habit of adding them.. they help in larger methods but I agree, not so much in these proxy methods..

I like it in larger methods because it makes it explicit what you can override and what not. I can remove them for clarity.

Line:229, src/main/java/com/couchbase/client/ClusterManager.java -> Oh interesting, I'll verify that. This would be a bug in the old code as well then :)

Line:318, src/main/java/com/couchbase/client/ClusterManager.java -> I always get that wrong :/

Line:544, src/main/java/com/couchbase/client/ClusterManager.java -> Yes, I copied the main "IO" layer code from the view class because it's self-contained. I wonder if we can refactor common functionality out, but maybe it doesn't pay off as much.

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