JRuby alarm signal

Hello,

I’m migrating an existing application to the JRuby and I have
encountered that the current version 1.5 of JRuby does not fully support
the ‘dl/import’ library which I use the load the UNIX signal alarm
functionality.
The application is currently using the alarm signal to trigger some
timely delayed data processing.

DL: This is only a partial implementation, and it’s likely broken
XXX: uninitialized constant DL::Importer (NameError)

I have found a similar post on this issue but I am looking for some
alternatives:

Is there a better, more portable (Unix/WIN) way to do this in JRuby or
should I just use java.util.Timer, java.util.TimerTask


module Alarm
require ‘dl/import’
extend DL::Importer
dlload ‘/usr/lib/hpux32/libc.so’
extern “unsigned int alarm(unsigned int)”
end

trap(“ALRM”) { # Do some processing… }

Some code… + set timer

Alarm.alarm(delayXX)

Thanks in advance for any advice!