Class | PhusionPassenger::ClassicRails::ApplicationSpawner
In: | lib/phusion_passenger/classic_rails/application_spawner.rb
Parent: | AbstractServer

Spawning of Rails 1 and Rails 2 applications.

ClassicRails::ApplicationSpawner can operate in two modes:

- Smart mode. In this mode, the Rails application‘s code is first preloaded into a temporary process, which can then further fork off application processes. Once the code has been preloaded, forking off application processes is very fast, and all the forked off application processes can share code memory with each other. To use this mode, create an ApplicationSpawner object, start it, and call spawn_application on it. A single ApplicationSpawner object can only handle a single Rails application.
- Conservative mode. In this mode, a Rails app process is directly spawned without any preloading. This increases compatibility with applications. To use this mode, call ApplicationSpawner.spawn_application.

### Methods

new spawn_application spawn_application start

### Included Modules

Utils DebugLogging

### Classes and Modules

Class PhusionPassenger::ClassicRails::ApplicationSpawner::Error

### Attributes

app_root | [R] | The application root of this spawner.

### Public Class methods

new(options)

The following options are accepted:

- ‘app_root‘

See SpawnManager#spawn_application for information about the options.

spawn_application(options)

Spawns an instance of a Rails application. When successful, an AppProcess object will be returned, which represents the spawned Rails application.

This method spawns the application directly, without preloading its code. This method may only be called if no Rails framework has been loaded in the current Ruby VM.

The "app_root" option must be given. All other options are passed to the request handler‘s constructor.

Raises:

- AppInitError: The Ruby on Rails application raised an exception or called exit() during startup.
- SystemCallError, IOError, SocketError: Something went wrong.

### Public Instance methods

spawn_application(options = {})

Spawns an instance of the Rails application. When successful, an AppProcess object will be returned, which represents the spawned Rails application.

`options` will be passed to the request handler‘s constructor.

Raises:

- AbstractServer::ServerNotStarted: The ApplicationSpawner server hasn‘t already been started.
- ApplicationSpawner::Error: The ApplicationSpawner server exited unexpectedly.

start()

Overrided from AbstractServer#start.

May raise these additional exceptions:

- AppInitError: The Ruby on Rails application raised an exception or called exit() during startup.
- ApplicationSpawner::Error: The ApplicationSpawner server exited unexpectedly.

[Validate]