<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -57,5 +57,3 @@ end
 
 autoload :MailHelper, 'action_mailer/mail_helper'
 autoload :TMail, 'action_mailer/vendor/tmail'
-
-ActionMailer.load_all! unless ENV['LAZY']</diff>
      <filename>actionmailer/lib/action_mailer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -100,5 +100,3 @@ autoload :Mime, 'action_controller/mime_type'
 
 autoload :HTML, 'action_controller/vendor/html-scanner'
 autoload :Rack, 'action_controller/vendor/rack'
-
-ActionController.load_all! unless ENV['LAZY']</diff>
      <filename>actionpack/lib/action_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,5 +55,3 @@ class ERB
 end
 
 I18n.load_path &lt;&lt; &quot;#{File.dirname(__FILE__)}/action_view/locale/en.yml&quot;
-
-ActionView.load_all! unless ENV['LAZY']</diff>
      <filename>actionpack/lib/action_view.rb</filename>
    </modified>
    <modified>
      <diff>@@ -75,5 +75,3 @@ end
 
 require 'active_record/i18n_interpolation_deprecation'
 I18n.load_path &lt;&lt; File.dirname(__FILE__) + '/active_record/locale/en.yml'
-
-ActiveRecord.load_all! unless ENV['LAZY']</diff>
      <filename>activerecord/lib/active_record.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,5 +55,3 @@ require 'active_support/core_ext'
 require 'active_support/json'
 
 I18n.load_path &lt;&lt; &quot;#{File.dirname(__FILE__)}/active_support/locale/en.yml&quot;
-
-ActiveSupport.load_all! unless ENV['LAZY']</diff>
      <filename>activesupport/lib/active_support.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *2.3.0 [Edge]*
 
+* Add config.preload_frameworks to load all frameworks at startup. Default to false so Rails autoloads itself as it's used. Turn this on for Passenger and JRuby. Also turned on by config.threadsafe!  [Jeremy Kemper]
+
 * Add a rake task to generate dispatchers : rake rails:generate_dispatchers [Pratik]
 
 * &quot;rails &lt;app&gt;&quot; will not generate public/dispatch.cgi/fcgi/rb files by default now. Please use &quot;--with-dispatchers&quot; option if you need them. [Yaroslav Markin, Pratik Naik]</diff>
      <filename>railties/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -136,6 +136,7 @@ module Rails
       add_gem_load_paths
 
       require_frameworks
+      preload_frameworks
       set_autoload_paths
       add_plugin_load_paths
       load_environment
@@ -264,6 +265,19 @@ module Rails
       raise e.to_s
     end
 
+    # Preload all frameworks specified by the Configuration#frameworks.
+    # Used by Passenger to ensure everything's loaded before forking and
+    # to avoid autoload race conditions in JRuby.
+    def preload_frameworks
+      if configuration.preload_frameworks
+        configuration.frameworks.each do |framework|
+          # String#classify and #constantize aren't available yet.
+          toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })
+          toplevel.load_all!
+        end
+      end
+    end
+
     # Add the load paths used by support functions such as the info controller
     def add_support_load_paths
     end
@@ -602,6 +616,9 @@ Run `rake gems:install` to install the missing gems.
     # A stub for setting options on ActiveSupport.
     attr_accessor :active_support
 
+    # Whether to preload all frameworks at startup.
+    attr_accessor :preload_frameworks
+
     # Whether or not classes should be cached (set to false if you want
     # application classes to be reloaded on each request)
     attr_accessor :cache_classes
@@ -768,6 +785,7 @@ Run `rake gems:install` to install the missing gems.
       self.log_level                    = default_log_level
       self.view_path                    = default_view_path
       self.controller_paths             = default_controller_paths
+      self.preload_frameworks           = default_preload_frameworks
       self.cache_classes                = default_cache_classes
       self.dependency_loading           = default_dependency_loading
       self.whiny_nils                   = default_whiny_nils
@@ -810,6 +828,7 @@ Run `rake gems:install` to install the missing gems.
     # multiple database connections. Also disables automatic dependency loading
     # after boot
     def threadsafe!
+      self.preload_frameworks = true
       self.cache_classes = true
       self.dependency_loading = false
       self.action_controller.allow_concurrency = true
@@ -955,6 +974,10 @@ Run `rake gems:install` to install the missing gems.
         true
       end
 
+      def default_preload_frameworks
+        false
+      end
+
       def default_cache_classes
         true
       end</diff>
      <filename>railties/lib/initializer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d01f75b1f091c37d14ece70cbe5f52f20f25d64c</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </author>
  <url>http://github.com/rails/rails/commit/104f3a57768602289299b3be0fab5b1ed21d7653</url>
  <id>104f3a57768602289299b3be0fab5b1ed21d7653</id>
  <committed-date>2008-11-24T18:43:04-08:00</committed-date>
  <authored-date>2008-11-24T18:43:04-08:00</authored-date>
  <message>Add config.preload_frameworks to load all frameworks at startup. Default to false so Rails autoloads itself as it's used.</message>
  <tree>8e467393ec0541d3db1cacd895e094e995574eb4</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
