Logo Search packages:      
Sourcecode: passenger version File versions  Download package

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

#include <StandardApplicationPool.h>

Inheritance diagram for Passenger::StandardApplicationPool:


List of all members.

Detailed Description

A standard implementation of ApplicationPool for single-process environments.

The environment may or may not be multithreaded - StandardApplicationPool is completely thread-safe. Apache with the threading MPM is an example of a multithreaded single-process environment.

This class is unusable in multi-process environments such as Apache with the prefork MPM. The reasons are as follows:

(Of course, StandardApplicationPool is usable if each process creates its own StandardApplicationPool object, but that would defeat the point of having a shared pool.)

For multi-process environments, one should use ApplicationPoolServer instead.

Definition at line 92 of file StandardApplicationPool.h.

Public Member Functions

virtual void clear ()
virtual Application::SessionPtr get (const string &appRoot, bool lowerPrivilege=true, const string &lowestUser="nobody", const string &environment="production", const string &spawnMethod="smart", const string &appType="rails")
virtual unsigned int getActive () const
virtual unsigned int getCount () const
virtual pid_t getSpawnServerPid () const
virtual void setMax (unsigned int max)
virtual void setMaxIdleTime (unsigned int seconds)
virtual void setMaxPerApp (unsigned int maxPerApp)
 StandardApplicationPool (const string &spawnServerCommand, const string &logFile="", const string &rubyCommand="ruby", const string &user="")
virtual string toString (bool lockMutex=true) const

Private Types

typedef list< AppContainerPtr > AppContainerList
typedef shared_ptr
< AppContainerList > 
typedef shared_ptr< AppContainer > AppContainerPtr
typedef map< string,
AppContainerListPtr > 
typedef shared_ptr< SharedData > SharedDataPtr

Private Member Functions

void cleanerThreadMainLoop ()
bool needsRestart (const string &appRoot)
pair< AppContainerPtr,
AppContainerList * > 
spawnOrUseExisting (mutex::scoped_lock &l, const string &appRoot, bool lowerPrivilege, const string &lowestUser, const string &environment, const string &spawnMethod, const string &appType)
template<typename LockActionType>
string toString (LockActionType lockAction) const
bool verifyState ()

Private Attributes

unsigned int & active
condition & activeOrMaxChanged
map< string, unsigned int > & appInstanceCount
ApplicationMap & apps
thread * cleanerThread
condition cleanerThreadSleeper
unsigned int & count
SharedDataPtr data
bool detached
bool done
AppContainerList & inactiveApps
mutex & lock
unsigned int & max
unsigned int maxIdleTime
unsigned int & maxPerApp
map< string, time_t > & restartFileTimes
SpawnManager spawnManager

Static Private Attributes

static const int CLEANER_THREAD_STACK_SIZE = 1024 * 128
static const int DEFAULT_MAX_IDLE_TIME = 120
static const int DEFAULT_MAX_INSTANCES_PER_APP = 0
static const int DEFAULT_MAX_POOL_SIZE = 20
static const unsigned int GET_TIMEOUT = 5000
static const unsigned int MAX_GET_ATTEMPTS = 10


class ApplicationPoolServer


struct  AppContainer
struct  SessionCloseCallback
struct  SharedData

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

Generated by  Doxygen 1.6.0   Back to index