[concurrency-interest] do constructors ever involve threading under the covers?

Andy Nuss andrew_nuss at yahoo.com
Wed Oct 3 09:24:33 EDT 2012


I have a class with a single member, a reference to a new MessageDigest obtained in the constructor based on the algorithm name passed to the constructor.  The constructor also has a Reader argument and reads all the data from the Reader thru an OutputStreamWriter("UTF-8) and passes thru to the digest with my own OutputStream filter.  The call to the constructor then accesses the MessageDigest member and calls digest() to get the resulting byte[].  My code by all appearances is single threaded, but I am having strange bugs that on one particular machine running vmware, the digest result I am getting (for password hashing) appears not to be repeatable.

Basically, I am wondering if another thread can execute the body of the constructor (or in the construction and use of the OutputStreamWriter, within my constructor) that could be causing a bug where memory written by the MessageDigest.update() function (triggered within the constructor by writing thru OutputStreamWriter) is not seen in the call to digest() on the newly created MessageDigest member after the constructor returns.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20121003/7c9c4673/attachment.html>

More information about the Concurrency-interest mailing list