# Passenger::AbstractSpawnManager Class Reference
[Apache-independent support classes and function]

Spawning of application processes. More...

`#include <AbstractSpawnManager.h>`

Inheritance diagram for Passenger::AbstractSpawnManager:
[legend]

List of all members.

## Public Member Functions
virtual ProcessPtr | spawn (const PoolOptions &options)=0
| Spawn a new application process.
virtual void | reload (const string &appRoot)=0
| Shutdown the ApplicationSpawner server that's running at the given application root.
virtual void | killSpawnServer () const =0
| Forcefully kill the spawn server.
virtual pid_t | getServerPid () const =0
| Returns the spawn server's PID.

## Detailed Description

Spawning of application processes.

An AbstractSpawnManager is responsible for spawning new application processes. Use the spawn() method to do so. AbstractSpawnManager is guaranteed to be thread-safe.

AbstractSpawnManager is just an interface. There are two concrete implementations, namely SpawnManager and StubSpawnManager. The former is the one that's usually used, while the latter exists for unit testing purposes.

## Member Function Documentation

virtual pid_t Passenger::AbstractSpawnManager::getServerPid | ( |  | ) | const`[pure virtual]`

Returns the spawn server's PID.

Used within unit tests.

Implemented in Passenger::SpawnManager.

virtual void Passenger::AbstractSpawnManager::killSpawnServer | ( |  | ) | const`[pure virtual]`

Forcefully kill the spawn server.

This AbstractSpawnManager's state will not be modified, so that it won't know that the spawn server is killed until next time it sends a command to it.

Used within unit tests.

Implemented in Passenger::SpawnManager.

virtual void Passenger::AbstractSpawnManager::reload | ( | const string & | appRoot | ) | `[pure virtual]`

Shutdown the ApplicationSpawner server that's running at the given application root.

This method should be called when it's time to reload an application.

Exceptions:

  | SystemException | Unable to communicate with the spawn server, even after a restart.
  | SpawnException | The spawn server died unexpectedly, and a restart was attempted, but it failed.

Implemented in Passenger::SpawnManager.

virtual ProcessPtr Passenger::AbstractSpawnManager::spawn | ( | const PoolOptions & | options | ) | `[pure virtual]`

Spawn a new application process.

Spawning details are to be passed via the `options` argument.

If the spawn server died during the spawning process, then the server will be automatically restarted, and another spawn attempt will be made. If restarting the server fails, or if the second spawn attempt fails, then an exception will be thrown.

Parameters:

  | options | An object containing the details for this spawn operation, such as which application to spawn. See PoolOptions for details.

Returns:
  A smart pointer to a Process object, which represents the application process that has been spawned. Use this object to communicate with the spawned process.

Exceptions:

  | SpawnException | Something went wrong.
  | boost::thread_interrupted |
  | Anything | thrown by options.environmentVariables->getItems().

Implemented in Passenger::SpawnManager.

The documentation for this class was generated from the following file:

- AbstractSpawnManager.h