#13 open
Kevin Williams

get working on JRuby

Reported by Kevin Williams | January 20th, 2008 @ 12:52 PM | in Future

discussed/requested on #thin

need ragel to output java, need to port thin.c to java(?), need to use either pure ruby version of EM or new java version of EM, or perhaps http://mina.apache.org/ for sockets

Comments and changes to this ticket

  • macournoyer

    macournoyer January 20th, 2008 @ 04:10 PM

    • State changed from “new” to “hold”

    How many ppl are gonna use this?

    I'm reluctant to do to this because it will require maintaining twice more code, in 2 languages. Mongrel already has a Java parser but we need to port all the changes to it. Plus I'm porting some parts of response writing to C. Writing extensions is already painful, writing it in 2 languages will be even more.

    If you'd like to use Thin on JRuby in production +1 the ticket. I'm putting on hold until I see lots of interest.

  • Kevin Williams

    Kevin Williams February 18th, 2008 @ 09:53 PM

    I'm still trying to get Ruby allowed at work, and JRuby is probably the runtime I'd have to use. Count me a +1 vote.

    EM (trunk) has a java version, Rack seems to install OK on JRuby, so I imagine the parser is the only piece not already there. It seems it wouldn't be too much work to port the Mongrel java parser.

    I've started playing with this today, but MacPorts has Ragel 6.0, which has breaking changes from older versions, so the *.rl files from Mongrel don't work.

  • macournoyer

    macournoyer February 18th, 2008 @ 10:42 PM

    • Milestone changed from 1.0 to Future

    I''m using Ragel 5.24, which I installed from source.

    This is clearly doable and since the parser doesn't change that much.

    But I wonder how EM performs on jruby. Anyone did some benchmarks?

  • Kevin Williams

    Kevin Williams February 24th, 2008 @ 09:41 AM

    we need EM to release for jruby before we can do anything.

  • macournoyer

    macournoyer February 25th, 2008 @ 05:00 PM

    • Assigned user set to “Kevin Williams”
    • Milestone changed from Future to 1.0
    • State changed from “hold” to “open”
  • macournoyer

    macournoyer July 1st, 2008 @ 09:49 AM

    • Tag set to java, jruby, platform
    • Milestone changed from 1.0 to Waiting for EM

    I red they are working on it right now

  • Kevin Williams
  • Kevin Williams

    Kevin Williams August 26th, 2008 @ 05:05 PM

    I'm working on a java-based backend for Thin. Not sure how it's going to work out because Thin depends on EM for more than just the backend. If we can divorce Thin from EM and constrain EM to backend code, then Thin on JRuby might really rock.

  • macournoyer

    macournoyer August 27th, 2008 @ 01:29 PM

    Aman sent me this:

    fyi, i got the java reactor working


    ran some of my EM libraries through it and it seems to work without modifications or problems



    @kevin: Thin should not depend on EM anymore, only Backends::Base does depend on it. thin-turbo is a non-EM backend and is works fine.

  • Kevin Williams

    Kevin Williams August 27th, 2008 @ 01:40 PM

    lib/thin.rb requires EM, and lib/thin/connection.rb has the Connection class extending EventMachine::Connection. Am I not looking at the right branch or something? I admit I haven't tried running Thin on JRuby without EM installed, but I didn't think I could yet. What am I missing?

  • macournoyer

    macournoyer August 28th, 2008 @ 12:03 PM

    ah right, we can fix that by require all things EM in the Backends::Base, so it it's not loaded EM will not be required.

    Hm, but we'll need to tweak the gem to require EM gem only on non-jruby installation.

    Any better way to make EM optional?

  • Kevin Williams

    Kevin Williams August 28th, 2008 @ 12:14 PM

    Perhaps have a safe alternate backend based on webrick or mongrel? The backend selection code could try to load the EM gem and choose a different backend if not found.

    That would probably mean creating an explicit EM backend, rather that putting EM stuff in Backends::Base.

  • Kevin Williams

    Kevin Williams December 22nd, 2008 @ 04:02 PM

    EM for JRuby isn't formally released, so I haven't tried to do anything yet. I'm continuing to working on getting something based on Mina to work. Almost got it now, just trying to figure out Rack and plugging the two together.

  • Kevin Williams

    Kevin Williams December 22nd, 2008 @ 04:28 PM

    The latest version of Mina - no, I haven't released it yet.

  • Kevin Williams

    Kevin Williams April 6th, 2009 @ 10:07 AM

    • Milestone changed from Waiting for EM to Future

    Thanks for the update Aman, it did install into my JRuby 1.2.0 install on my laptop. Unfortunately, http://rubyeventmachine.com/wiki... claims it is not officially released yet.

    I'll start working on it now. The first thing I have to do is get the Mongrel parser for Java into Thin and updated with the equivalent code for the ext/thin_parser/thin.c features. This is not familiar ground for me, so it might take a while.

  • Kevin Williams

    Kevin Williams January 13th, 2012 @ 01:42 PM

    I've been dabbling with my Mina (now Netty) based server for years now. I rarely have time to work on it, and when I do, it never works quite right.

    Something very close to what I've been trying to build is https://github.com/matadon/mizuno which uses Jetty. Mizuno seems to work, which is more than I can say for my server. :)

    Now that EventMachine does work on JRuby, perhaps very little is needed to get Thin to work, although the http-parser extension might be a problem. I'd be surprised if it were faster than something more native to Java based on Netty or Jetty, though.

    I don't code in Ruby anymore, and I'm worried about the future of Java in general, so of anyone would like to take this over I'll be happy to hand over responsibility.

  • John

    John February 28th, 2024 @ 01:30 PM

    Κατά την ταπεινή μου γνώμη, οι άνθρωποι σε όλο τον κόσμο λατρεύουν να παίζουν σε online καζίνοΔεν υπάρχουν πολλά μεγάλα online καζίνο. Αν κοιτάξετε το καζίνο Ice Casino, θα δείτε ότι μπορεί να σας βοηθήσει να τελειώσετε μια δουλειά που μισείτε, είπε. Σύμφωνα με τις στατιστικές, αυτό το online καζίνο έχει την υψηλότερη https://icecasino-gr.com/ RTP

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป