Created
July 11, 2012 20:33
-
-
Save mrjabba/3093156 to your computer and use it in GitHub Desktop.
how to schedule a newScheduledThreadPool in jruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
java_import 'java.util.concurrent.Executors' | |
java_import 'java.util.concurrent.TimeUnit' | |
class SomeClass | |
include java.lang.Runnable | |
def run | |
puts "imma lil jruby runner" | |
end | |
end | |
class Scheduler | |
def schedule | |
puts "starting..." | |
service = Executors.newScheduledThreadPool(1); | |
service.scheduleAtFixedRate(SomeClass.new, 4, 2, TimeUnit::SECONDS); | |
puts "i can haz service? #{service.class}" | |
puts "done..." | |
end | |
end | |
Scheduler.new.schedule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks Dave! :-)