DESCRIPTION

Added vbucket configuration parser from JSON.

This parser from JSON has several methods for parsing JSON, beans to
store configuration settings and unit tests.

Change-Id: I478b274e7901e8c1729c20fcc29577b8aff651ae


COMMENTS

author: Kenny Maynard
date: 2011-05-25 19:20:36.577000000

Patch Set 1: Looks good to me, but someone else must approve



-------------------------------------
author: Asher Vang
date: 2011-05-25 21:33:30.653000000

Patch Set 1:

Did you forget to add the documentation?

Is this going to be a public API or something to be used inside spy?

-------------------------------------
author: Andreas Short
date: 2011-05-25 21:52:25.130000000

Patch Set 1:

Used internal to spy.  Yes, docs are missing, but they're minor for this commit.  Will come later.

-------------------------------------
author: Noah Dean
date: 2011-05-26 00:07:48.738000000

Patch Set 1: I would prefer that you didn't submit this

(1 inline comment)

I'm concerned about the general mutability of stuff here.  Almost every object here is mutable, and one (line-commented) hints at thread safety when it's just not.

I realize I'm not all that much of a java programmer, but I do think that anything mutable needs to be justified.  Is there a reason we can't make just about all of this stuff immutable?

Line:22, src/main/java/net/spy/memcached/vbucket/config/Pool.java -> This is a bit alarming.  It looks like someone thought about multi-threading, but there are tons of things in here that just aren't threadsafe.  I'd rather see everything be immutable, of course, but at the very least reduce the objects that are signaling that their state may change while being accessed.

-------------------------------------
author: Andreas Short
date: 2011-05-26 00:22:36.318000000

Patch Set 1:

@Noah Dean

Somehow I thought you'd say something like that when I was reviewing the commit before submission.  Your points are valid.

I'll have to review more closely, but I believe the full pool object is swapped out.

-------------------------------------
author: Andreas Short
date: 2011-05-26 00:25:04.576000000

Patch Set 1:

Oh, and by the way, you can imagine what the commit looked like before I submitted it.

-------------------------------------
author: Noah Dean
date: 2011-05-26 00:27:22.411000000

Patch Set 1:

I don't want to be a pain about it, but it's hard to get things right when they can change without you knowing.  It's hard to get things wrong when they can't.  I've proven you can still do the latter at least, of course.

-------------------------------------
author: Jakob Lozano
date: 2011-05-26 01:12:52.703000000

Patch Set 1: (4 inline comments)

Agreed with all the comments about immutability.

A good model for immutable classes are Google Guava's classes.  I've learned a lot about how they've done things.

http://code.google.com/p/guava-libraries/

Line:22, src/main/java/net/spy/memcached/vbucket/config/Pool.java -> Agreed.  Better to make the pool and everything it holds immutable.  Safer code and everything can be final, leading to better performance.

Line:11, src/main/java/net/spy/memcached/vbucket/config/Bucket.java -> It would be nice to have this class be immutable, if nothing needs to change it.  A quick scan of this diff shows that it's only set in the configuration tester.  I would rather see a BucketBuilder that builds a Bucket.  After making it immutable, then all the private fields can be made final and the vbuckets can be checked for not null.

Line:6, src/main/java/net/spy/memcached/vbucket/config/Node.java -> Nothing sets these, so make them final.

Line:8, src/main/java/net/spy/memcached/vbucket/config/Node.java -> Want to make a defensive copy of ports?

BTW, using Google Guava's ImmutableMap would be nice here, since you are ensured nobody is going to change the Map underneath you.

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