RubyThreadGroup: make list() thread-safe.

If two different threads accesses list() at same time,
WeakHashMap.java:882:in `nextEntry': java.util.ConcurrentModificationException
happens.
Use COW list for event hooks, to avoid synchronization.

See jruby/jruby#1142. This supercedes a fix there.

I opted to use CopyOnWriteArrayList here for two reasons:

* It does not require synchronization, neither for access nor iter
* EventHooks should are only added or removed rarely
Add a guard against nil RubyThreadGroup for a thread.

This is just here since I seem to get this error quite a bit.
I guess correct way would be to ensure somehow that there always
is the default group, but quick search didn’t give me any idea
how it can be missing in first place.