Thread safety

69 views
Skip to first unread message

Thomas Themel

unread,
Apr 5, 2012, 5:23:45 PM4/5/12
to sca...@googlegroups.com
Hi all,

I just ran into random NullPointerExceptions inside my fromXML calls which I couldn't really explain to myself until I found this Scala issue: 


I'm indeed running concurrent threads parsing scalaxb responses and never encounter any issues when trying to parse the messages that caused the mystery NPEs in the console, so it seems quite likely that this thread-safety issue is the culprit. Until this is fixed in Scala, is there an easy way to enjoy the simplicity of fromXML in a multithreaded environment?

ciao,
Thomas

eugene yokota

unread,
Apr 5, 2012, 9:39:04 PM4/5/12
to sca...@googlegroups.com
Putting thread monitors around it would be the quick way to make sure
that only one thread calls fromXML at a time.
Are you using fromXML in a bunch of different places, or just one?

-eugene

greg

unread,
May 13, 2012, 8:52:33 PM5/13/12
to sca...@googlegroups.com
ran into this myself today. fortunately I'm calling fromXML in a single def which I was able to synchronize for now.
Reply all
Reply to author
Forward
0 new messages