public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Improve documentation
Hongli Lai (Phusion) (author)
Fri Mar 07 10:57:59 -0800 2008
commit  ca9a130d2b937472e54468b529efacb15d9cc055
tree    ee0dd952ef8e5376a589179b4e4beacce0c6fa2d
parent  3b3f3bdc3d76e8e91f55b0a5accfe1d0eb59ec50
...
6
7
8
9
10
11
12
13
...
63
64
65
66
 
67
68
69
...
6
7
8
 
 
9
10
11
...
61
62
63
 
64
65
66
67
0
@@ -6,8 +6,6 @@ require 'passenger/application_spawner'
0
 require 'passenger/utils'
0
 module Passenger
0
 
0
-# TODO: check whether preloading Rails was successful
0
-
0
 # This class is capable of spawning Ruby on Rails application instances
0
 # quickly. This is done by preloading the Ruby on Rails framework into memory,
0
 # before spawning the application instances.
0
@@ -63,7 +61,7 @@ class FrameworkSpawner < AbstractServer
0
   # Overrided from AbstractServer#start.
0
   #
0
   # May raise these additional exceptions:
0
- # - InitializationError: The given Ruby on Rails framework could not be loaded.
0
+ # - InitializationError: The specified Ruby on Rails framework could not be loaded.
0
   # - IOError, SystemCallError, SocketError: The FrameworkSpawner server crashed.
0
   def start
0
     super
...
13
14
15
 
 
 
 
 
16
17
18
...
33
34
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
37
38
...
60
61
62
63
 
64
65
66
...
77
78
79
 
 
80
81
82
...
13
14
15
16
17
18
19
20
21
22
23
...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
...
86
87
88
 
89
90
91
92
...
103
104
105
106
107
108
109
110
0
@@ -13,6 +13,11 @@ module Passenger
0
 # Internally, SpawnManager uses FrameworkSpawner to preload and cache
0
 # Ruby on Rails frameworks. FrameworkSpawner, in turn, uses
0
 # ApplicationSpawner to preload and cache application code.
0
+#
0
+# *Note*: SpawnManager may only be started synchronously with
0
+# AbstractServer#start_synchronously. Starting asynchronously has not been
0
+# tested. Don't forget to call cleanup after the server's main loop has
0
+# finished.
0
 class SpawnManager < AbstractServer
0
   DEFAULT_INPUT_FD = 3
0
   SPAWNER_CLEAN_INTERVAL = 30 * 60
0
@@ -33,6 +38,27 @@ class SpawnManager < AbstractServer
0
     define_signal_handler('SIGHUP', :reload)
0
   end
0
 
0
+ # Spawn a RoR application When successful, an Application object will be
0
+ # returned, which represents the spawned RoR application.
0
+ #
0
+ # See ApplicationSpawner.new for an explanation of the +lower_privilege+
0
+ # and +lowest_user+ parameters.
0
+ #
0
+ # SpawnManager will internally cache the code of applications, in order to
0
+ # speed up future spawning attempts. This implies that, if you've
0
+ # changed the application's code, you must do one of these things:
0
+ # - Restart this SpawnManager by calling AbstractServer#stop, then AbstractServer#start.
0
+ # - Reload the application by calling reload with the correct app_root argument.
0
+ #
0
+ # Raises:
0
+ # - ArgumentError: +app_root+ doesn't appear to be a valid Ruby on Rails application root.
0
+ # - VersionNotFound: The Ruby on Rails framework version that the given application requires
0
+ # is not installed.
0
+ # - InitializationError: Either the Ruby on Rails framework version that the given application
0
+ # requires could not be loaded, or the application raised an exception or called exit()
0
+ # during startup.
0
+ # - IOError: The ApplicationSpawner server exited unexpectedly.
0
+ # - SpawnError: The FrameworkSpawner server exited unexpectedly.
0
   def spawn_application(app_root, lower_privilege = true, lowest_user = "nobody")
0
     options = {}
0
     framework_version = Application.detect_framework_version(app_root)
0
@@ -60,7 +86,7 @@ class SpawnManager < AbstractServer
0
   # If nil is specified as application root, then all cached application
0
   # instances will be removed, no matter the application root.
0
   #
0
- # _Long description:_
0
+ # <b>Long description:</b>
0
   # Application code might be cached in memory. But once it a while, it will
0
   # be necessary to reload the code for an application, such as after
0
   # deploying a new version of the application. This method makes sure that
0
@@ -77,6 +103,8 @@ class SpawnManager < AbstractServer
0
     end
0
   end
0
   
0
+ # Cleanup resources. Should be called after AbstractServer#start_synchronously
0
+ # is called.
0
   def cleanup
0
     @lock.synchronize do
0
       @cond.signal

Comments

    No one has commented yet.