dnrajugade / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Clone MessageDigest in MessageDigestHashFunction instead of calling MessageDigest.getInstance() #1197

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We have code that uses MD5 hashing from many threads concurrently.  We found 
that this can result in a lot of blocked threads due to calls to 
Provider.getService() (which is synchronized).  We were able to work around 
this by cloning the MessageDigest directly instead (as suggested here: 
https://groups.google.com/forum/?fromgroups=#!topic/spymemcached/FGvTn6lczmo).  

Assuming this has no downsides (like incompatibility with certain JVM 
implementations), it would be nice to have the Guava implementation clone as 
well so that anyone using Guava wouldn't have to worry about this issue.

Original issue reported on code.google.com by derekcic...@gmail.com on 8 Nov 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Interesting...I'll play around with this and see if it causes any problems.

Original comment by kurt.kluever on 9 Nov 2012 at 12:27

GoogleCodeExporter commented 9 years ago
Submitting this internally now...should be mirrored out tomorrow morning :-)

Original comment by kak@google.com on 9 Nov 2012 at 9:18

GoogleCodeExporter commented 9 years ago
wow, that was really quick.  you guys are awesome!

Original comment by derekcic...@gmail.com on 9 Nov 2012 at 9:19

GoogleCodeExporter commented 9 years ago
Actually I forgot today is Friday...so it probably won't get mirrored out until 
Monday morning (and possibly Tuesday morning, because I'm going to write a 
Caliper benchmark for this change...)

Original comment by kak@google.com on 9 Nov 2012 at 9:27

GoogleCodeExporter commented 9 years ago

Original comment by lowas...@google.com on 26 Dec 2012 at 5:01

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08