Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A JRuby extension/wrapper around the Java 7 Fork/Join framework
branch: master
Failed to load latest commit information.
examples Update wordcount sample for benchmarking
javalib Prepare for 1.0.0 gem release.
lib Prepare for 1.0.0 gem release.
src/org/jruby/ext Format Ruby code
build.xml Prepare for 1.0.0 gem release. Add build.xml
forkjoin.gemspec Roll to 1.0.1 to pick up commits I had not pulled.

forkjoin for JRuby

This is a small extension that wraps the JSR166y "Fork/Join" framework in an efficient way for JRuby.


require 'forkjoin'

pool =


# Add a job (a proc) to the pool for each line
map_futures = pool.invoke_all({|line| ->{{|word| [word,1]}}}

# Get aggregate results
counts ={}) {|map, value|
  value.each {|k,v| (map[k] ||= []) << v}


# Add a job to the pool for each count in the map
reduced_futures = pool.invoke_all({|k, vs| ->{[k, vs.size]}}

# Print out results (or you could "reduce" some other way){|value|
  puts "%s %d\n" % value
Something went wrong with that request. Please try again.