Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 757115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:19:29+00:00 2026-05-14T15:19:29+00:00

I have a jruby/rails app using: jruby 1.4.0 Rails 2.3.5 ActiveMQ 5.3.0 Mule ESB

  • 0

I have a jruby/rails app using:

jruby 1.4.0
Rails 2.3.5
ActiveMQ 5.3.0
Mule ESB 2.2.1

Currently in our environment.rb file we start up Mule in the initializer. This becomes a big pain when we go to do normal rake tasks that don’t require JMS/Mule such as db:migrate as it takes a long time to startup/shutdown Mule everytime.

The code is similar to this:

APP_CONTEXT = Java::our.company.package.service_clients.Initializer.getAppContext(MULE_CONFIG_PATH)

And we use APP_CONTEXT to fetch the bean to connect to the appropriate service.

I’m trying to figure out some mechanism by which APP_CONTEXT could be lazily instantiated (not in initialize) to avoid all of the pains of having to startup Mule on initialize.

Currently we have a few ruby client classes that are instantiated as a before_filter in application_controller such as @data_service = DataService.new(APP_CONTEXT) that initialize the proper java client for each request for use in our controllers.

I’m open to all suggestions. I’m having a hard time trying to find the right place to put this lazy instantiation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:19:29+00:00Added an answer on May 14, 2026 at 3:19 pm

    In the end, (and i don’t know why i didn’t think of this) I’ve just made a class App that has a class method returning

    @context ||= Java::our.company.package.service_clients.Initializer.getAppContext(MULE_CONFIG_PATH)
    

    I’m not sure what was going through my head but I thought maybe if this was referenced by two functions at the same time, I’d have two different instantiations of the AppContext, forgetting that in Ruby a class is really just a singleton object, so this will always return the one context.

    class App
    
      def self.context
        @context ||= Java::our.company.package.service_clients.Initializer.getAppContext(MULE_CONFIG_PATH)
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jruby rails app and I've just started using bundler for gem
I have a simple Rails 3.1 CRUD app built using Oracle running on JRuby.
I have Rails app set up using Jruby with puma as the web server.
I'm considering using JRuby on App Engine but have heard that Juby app on
I'm trying to create thumbnails for uploaded images in a JRuby/Rails app using the
I'm trying to deploy a Rails app as a WAR using Warbler. I have
I'm about to start rewriting bits and pieces of our Rails app that do
I have a Web application using Jruby and Sinatra (App Engine) and I want
I have some trouble with using authlogic in my rails app, so I began
I am using Jruby and rails 2.2.2. My problem is I have a migration

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.