JRubyで並列実行するにはコツがいるということで、synchronizeを利用しない方法を紹介する。こんなの↓が話題。 str = '' max = 1000 (1..4).map{|e| Thread.new(e){|ti| max.times{ str % jruby tmp.rb System.java:-2:in `java.lang.System.arraycopy': java.lang.ArrayIndexOutOfBoundsException: null (NativeException) from ByteList.java:198:in `org.jruby.util.ByteList.append' from ByteList.java:189:in `org.jruby.util.ByteList.append' from RubyString.java:71