Forum: JRuby CallbackFactory deprecated; what is a contemporary example?

Af6bfc00d45e2d4bf0d5d2c4da020697?d=identicon&s=25 Chris Kruger (Guest)
on 2013-05-22 04:48
(Received via mailing list)
Hello Jruby Folks,

So I am trying to implement some Jruby extensions using the
BasicLibraryService class based on this blog entry

http://ola-bini.blogspot.com.au/2006/10/jruby-tuto...

I'm using jruby-1.7.4 and it seem that the callbackFactory method on
Ruby object is now setup to throw an exception because the that
technique is deprecated.

The documentation talks about using MethodFactories now, instead of the
CallbackFactory. However I could not glean from the documentation how
this was supposed to work.

The code that does not work looks like below

 public boolean basicLoad(final Ruby runtime) throws IOException {
         RubyModule string = runtime.getModule("String");
          CallbackFactory fact =
runtime.callbackFactory(FastXsService.class);
          string.defineMethod("fast_xs",fact.getFastSingletonMethod("fast_xs"
));
          return true;
  }

What's the contemporary equivalent using MethodFactory?  Where do I get
a MethodFactory instantiated with everything I need?

Thanks in advance for any help!

Chris Kruger
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.