Jruby stability

Two small fixes to improve the stability of JRuby. See also #377

It seems that ThreadGroup isn't even used for anything, and it causes scary errors, so I just removed it. Tests still pass. Am I missing something?

Also fixed a race condition in the specs.