DESCRIPTION

HashAlgorithm registry to add new algorithms from config

Change-Id: Ie323151b67608e454b726050bd80b097cfba724c


COMMENTS

author: Tatum Robbins
date: 2011-08-06 02:47:32.380000000

Uploaded patch set 6.

-------------------------------------
author: Kenny Maynard
date: 2011-08-06 04:14:50.474000000

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



-------------------------------------
author: Noah Dean
date: 2011-08-13 01:01:55.268000000

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

(2 inline comments)

I don't like the error handling code that much, but it seems OK overall.

Are we guaranteed to have the enum initialized before this static block runs?

Line:43, src/main/java/net/spy/memcached/HashAlgorithmRegistry.java -> I'd rather throw NPE here.

Line:59, src/main/java/net/spy/memcached/HashAlgorithmRegistry.java -> I'd rather throw NPE here.

-------------------------------------
author: Tatum Robbins
date: 2011-08-13 01:51:41.367000000

Patch Set 6: (2 inline comments)

Dustin, 

Not sure I totally follow your concern regarding using of enums in static block.

Classloader loads class once it's being referenced, so that could be the case here unless some other class will try to do that before. But I'm pretty sure we won't have any "not initialized" errors here.

Would you +1 if I fix the "exceptions throwing part"?

Line:43, src/main/java/net/spy/memcached/HashAlgorithmRegistry.java -> I'd prefer throwing of IllegalArgumentExpetion here rather then NPE (in case we are going to throw exception here anyway)

Line:59, src/main/java/net/spy/memcached/HashAlgorithmRegistry.java -> Same here

-------------------------------------
author: Noah Dean
date: 2011-08-13 01:56:56.777000000

Patch Set 6:

I think you described what I was asking pretty well.

Let's push it without the special null handling.  If someone uses it wrong, we can give them an NPE instead of silently eating their words.

Thanks a lot.

-------------------------------------
author: Noah Dean
date: 2011-08-13 01:58:14.754000000

Patch Set 6:

Sorry, didn't read the lines.  IllegalArgumentException would also be OK.  NPE is a subtle difference.  You just get it for free in some of these cases.

-------------------------------------
author: Tatum Robbins
date: 2011-08-13 02:07:59.773000000

Patch Set 6:

You know what? Now I think we should definitely raise an exception there :)

The library should react on such kind of mistakes in a more agresive way, making "clients" to be more responsible for what they are passing to registry.

I'm going to submit another patch with this change. Any objections?

-------------------------------------
author: Andreas Short
date: 2011-08-13 02:10:11.914000000

Patch Set 6:

Makes sense to me.

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