Class PhusionPassenger::ClassicRails::FrameworkSpawner
In: lib/phusion_passenger/classic_rails/framework_spawner.rb
Parent: AbstractServer

This class is capable of spawning Ruby on Rails application instances quickly. This is done by preloading the Ruby on Rails framework into memory, before spawning the application instances.

A single FrameworkSpawner instance can only hold a single Ruby on Rails framework version. So be careful when using FrameworkSpawner: the applications that you spawn through it must require the same RoR version. To handle multiple RoR versions, use multiple FrameworkSpawner instances.

FrameworkSpawner uses ApplicationSpawner internally.

Note: FrameworkSpawner may only be started asynchronously with AbstractServer#start. Starting it synchronously with AbstractServer#start_synchronously has not been tested.

Methods

new   reload   spawn_application   start  

Included Modules

Utils

Classes and Modules

Class PhusionPassenger::ClassicRails::FrameworkSpawner::Error

Public Class methods

Creates a new instance of FrameworkSpawner.

Extra supported options:

  • framework_version: The Ruby on Rails version to use. It is not checked whether this version is actually installed.

All other options will be passed on to ApplicationSpawner and RequestHandler.

Note that the specified Rails framework will be loaded during the entire life time of the FrameworkSpawner server. If you wish to reload the Rails framework‘s code, then restart the server by calling AbstractServer#stop and AbstractServer#start.

Public Instance methods

Remove the cached application instances at the given group name. If nil is specified as group name, then all cached application instances will be removed, no matter the group name.

Long description: Application code might be cached in memory by a FrameworkSpawner. But once it a while, it will be necessary to reload the code for an application, such as after deploying a new version of the application. This method makes sure that any cached application code is removed, so that the next time an application instance is spawned, the application code will be freshly loaded into memory.

Raises:

Spawn a RoR application using the Ruby on Rails framework version associated with this FrameworkSpawner. When successful, an Application object will be returned, which represents the spawned RoR application.

All options accepted by ApplicationSpawner.new and RequestHandler.new are accepted.

FrameworkSpawner will internally cache the code of applications, in order to speed up future spawning attempts. This implies that, if you‘ve changed the application‘s code, you must do one of these things:

Raises:

Overrided from AbstractServer#start.

May raise these additional exceptions:

[Validate]