passenger 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (116) hide show
  1. data/Rakefile +1 -1
  2. data/bin/passenger-install-apache2-module +4 -3
  3. data/doc/ApplicationPool algorithm.txt +8 -4
  4. data/doc/Users guide.html +1 -1
  5. data/doc/cxxapi/ApplicationPoolServer_8h-source.html +630 -623
  6. data/doc/cxxapi/ApplicationPool_8h-source.html +1 -1
  7. data/doc/cxxapi/Application_8h-source.html +1 -1
  8. data/doc/cxxapi/Bucket_8h-source.html +1 -1
  9. data/doc/cxxapi/Configuration_8h-source.html +2 -2
  10. data/doc/cxxapi/DummySpawnManager_8h-source.html +1 -1
  11. data/doc/cxxapi/Exceptions_8h-source.html +1 -1
  12. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  13. data/doc/cxxapi/Logging_8h-source.html +1 -1
  14. data/doc/cxxapi/MessageChannel_8h-source.html +1 -1
  15. data/doc/cxxapi/SpawnManager_8h-source.html +1 -1
  16. data/doc/cxxapi/StandardApplicationPool_8h-source.html +258 -259
  17. data/doc/cxxapi/System_8h-source.html +1 -1
  18. data/doc/cxxapi/Utils_8h-source.html +1 -1
  19. data/doc/cxxapi/annotated.html +1 -1
  20. data/doc/cxxapi/classClient-members.html +1 -1
  21. data/doc/cxxapi/classClient.html +1 -1
  22. data/doc/cxxapi/classDirectoryMapper-members.html +1 -1
  23. data/doc/cxxapi/classDirectoryMapper.html +1 -1
  24. data/doc/cxxapi/classHooks-members.html +1 -1
  25. data/doc/cxxapi/classHooks.html +1 -1
  26. data/doc/cxxapi/classPassenger_1_1Application-members.html +1 -1
  27. data/doc/cxxapi/classPassenger_1_1Application.html +1 -1
  28. data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +1 -1
  29. data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +1 -1
  30. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +1 -1
  31. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +1 -1
  32. data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +1 -1
  33. data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +1 -1
  34. data/doc/cxxapi/classPassenger_1_1BusyException-members.html +1 -1
  35. data/doc/cxxapi/classPassenger_1_1BusyException.html +1 -1
  36. data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +1 -1
  37. data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +1 -1
  38. data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +1 -1
  39. data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +1 -1
  40. data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +1 -1
  41. data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +1 -1
  42. data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +1 -1
  43. data/doc/cxxapi/classPassenger_1_1FileSystemException.html +1 -1
  44. data/doc/cxxapi/classPassenger_1_1IOException-members.html +1 -1
  45. data/doc/cxxapi/classPassenger_1_1IOException.html +1 -1
  46. data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +1 -1
  47. data/doc/cxxapi/classPassenger_1_1MessageChannel.html +1 -1
  48. data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +1 -1
  49. data/doc/cxxapi/classPassenger_1_1SpawnException.html +1 -1
  50. data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +1 -1
  51. data/doc/cxxapi/classPassenger_1_1SpawnManager.html +1 -1
  52. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +1 -1
  53. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +1 -1
  54. data/doc/cxxapi/classPassenger_1_1SystemException-members.html +1 -1
  55. data/doc/cxxapi/classPassenger_1_1SystemException.html +1 -1
  56. data/doc/cxxapi/classPassenger_1_1TempFile-members.html +1 -1
  57. data/doc/cxxapi/classPassenger_1_1TempFile.html +1 -1
  58. data/doc/cxxapi/classPassenger_1_1Thread-members.html +1 -1
  59. data/doc/cxxapi/classPassenger_1_1Thread.html +1 -1
  60. data/doc/cxxapi/classboost_1_1this__thread_1_1disable__syscall__interruption-members.html +1 -1
  61. data/doc/cxxapi/classboost_1_1this__thread_1_1disable__syscall__interruption.html +1 -1
  62. data/doc/cxxapi/classboost_1_1this__thread_1_1enable__syscall__interruption-members.html +1 -1
  63. data/doc/cxxapi/classboost_1_1this__thread_1_1enable__syscall__interruption.html +1 -1
  64. data/doc/cxxapi/classboost_1_1this__thread_1_1restore__syscall__interruption-members.html +1 -1
  65. data/doc/cxxapi/classboost_1_1this__thread_1_1restore__syscall__interruption.html +1 -1
  66. data/doc/cxxapi/definitions_8h-source.html +1 -1
  67. data/doc/cxxapi/files.html +1 -1
  68. data/doc/cxxapi/functions.html +1 -1
  69. data/doc/cxxapi/functions_func.html +1 -1
  70. data/doc/cxxapi/functions_type.html +1 -1
  71. data/doc/cxxapi/functions_vars.html +1 -1
  72. data/doc/cxxapi/graph_legend.html +1 -1
  73. data/doc/cxxapi/group__Configuration.html +3 -3
  74. data/doc/cxxapi/group__Core.html +1 -1
  75. data/doc/cxxapi/group__Exceptions.html +1 -1
  76. data/doc/cxxapi/group__Hooks.html +1 -1
  77. data/doc/cxxapi/group__Support.html +1 -1
  78. data/doc/cxxapi/hierarchy.html +1 -1
  79. data/doc/cxxapi/inherits.html +1 -1
  80. data/doc/cxxapi/main.html +1 -1
  81. data/doc/cxxapi/modules.html +1 -1
  82. data/doc/cxxapi/namespacePassenger.html +1 -1
  83. data/doc/cxxapi/namespacePassenger_1_1InterruptableCalls.html +1 -1
  84. data/doc/cxxapi/namespacemembers.html +1 -1
  85. data/doc/cxxapi/namespacemembers_func.html +1 -1
  86. data/doc/cxxapi/namespacemembers_type.html +1 -1
  87. data/doc/cxxapi/namespaces.html +1 -1
  88. data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +1 -1
  89. data/doc/cxxapi/structPassenger_1_1AnythingToString.html +1 -1
  90. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +1 -1
  91. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +1 -1
  92. data/doc/rdoc/classes/PlatformInfo.html +1 -1
  93. data/doc/rdoc/created.rid +1 -1
  94. data/doc/rdoc/files/DEVELOPERS_TXT.html +1 -1
  95. data/doc/rdoc/files/ext/passenger/native_support_c.html +1 -1
  96. data/doc/rdoc/files/lib/passenger/abstract_request_handler_rb.html +1 -1
  97. data/doc/rdoc/files/lib/passenger/abstract_server_rb.html +1 -1
  98. data/doc/rdoc/files/lib/passenger/application_rb.html +1 -1
  99. data/doc/rdoc/files/lib/passenger/constants_rb.html +1 -1
  100. data/doc/rdoc/files/lib/passenger/dependencies_rb.html +1 -1
  101. data/doc/rdoc/files/lib/passenger/exceptions_rb.html +1 -1
  102. data/doc/rdoc/files/lib/passenger/message_channel_rb.html +1 -1
  103. data/doc/rdoc/files/lib/passenger/platform_info_rb.html +1 -1
  104. data/doc/rdoc/files/lib/passenger/spawn_manager_rb.html +1 -1
  105. data/doc/rdoc/files/lib/passenger/utils_rb.html +1 -1
  106. data/ext/apache2/ApplicationPoolServer.h +7 -0
  107. data/ext/apache2/ApplicationPoolServerExecutable.cpp +7 -0
  108. data/ext/apache2/Configuration.h +1 -1
  109. data/ext/apache2/Hooks.cpp +22 -32
  110. data/ext/apache2/StandardApplicationPool.h +3 -4
  111. data/ext/apache2/System.cpp +12 -2
  112. data/ext/passenger/native_support.c +1 -1
  113. data/lib/passenger/dependencies.rb +13 -7
  114. data/lib/passenger/platform_info.rb +1 -1
  115. data/lib/passenger/railz/application_spawner.rb +9 -1
  116. metadata +2 -2
@@ -217,7 +217,7 @@
217
217
  <a name="l00200"></a>00200
218
218
  <a name="l00201"></a>00201 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_APPLICATION_POOL_H_ */</span>
219
219
  </pre></div></div>
220
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
220
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
221
221
  <a href="http://www.doxygen.org/index.html">
222
222
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
223
223
  </body>
@@ -441,7 +441,7 @@
441
441
  <a name="l00424"></a>00424
442
442
  <a name="l00425"></a>00425 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_APPLICATION_H_ */</span>
443
443
  </pre></div></div>
444
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
444
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
445
445
  <a href="http://www.doxygen.org/index.html">
446
446
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
447
447
  </body>
@@ -54,7 +54,7 @@
54
54
  <a name="l00037"></a>00037 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_BUCKET_H_ */</span>
55
55
  <a name="l00038"></a>00038
56
56
  </pre></div></div>
57
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
57
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
58
58
  <a href="http://www.doxygen.org/index.html">
59
59
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
60
60
  </body>
@@ -48,7 +48,7 @@
48
48
  <a name="l00031"></a>00031 <span class="comment"> */</span>
49
49
  <a name="l00032"></a>00032 <span class="comment"></span>
50
50
  <a name="l00033"></a>00033 <span class="comment">/** Module version number. */</span>
51
- <a name="l00034"></a><a class="code" href="group__Configuration.html#ga19398896775408d6ab7fd8ce2acd992">00034</a> <span class="preprocessor">#define PASSENGER_VERSION "2.0.4"</span>
51
+ <a name="l00034"></a><a class="code" href="group__Configuration.html#ga19398896775408d6ab7fd8ce2acd992">00034</a> <span class="preprocessor">#define PASSENGER_VERSION "2.0.5"</span>
52
52
  <a name="l00035"></a>00035 <span class="preprocessor"></span>
53
53
  <a name="l00036"></a>00036 <span class="preprocessor">#ifdef __cplusplus</span>
54
54
  <a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;set&gt;</span>
@@ -188,7 +188,7 @@
188
188
  <a name="l00171"></a>00171
189
189
  <a name="l00172"></a>00172 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_CONFIGURATION_H_ */</span>
190
190
  </pre></div></div>
191
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
191
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
192
192
  <a href="http://www.doxygen.org/index.html">
193
193
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
194
194
  </body>
@@ -119,7 +119,7 @@
119
119
  <a name="l00102"></a>00102
120
120
  <a name="l00103"></a>00103 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_DUMMY_SPAWN_MANAGER_H_ */</span>
121
121
  </pre></div></div>
122
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
122
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
123
123
  <a href="http://www.doxygen.org/index.html">
124
124
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
125
125
  </body>
@@ -237,7 +237,7 @@
237
237
  <a name="l00220"></a>00220
238
238
  <a name="l00221"></a>00221 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_EXCEPTIONS_H_ */</span>
239
239
  </pre></div></div>
240
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
240
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
241
241
  <a href="http://www.doxygen.org/index.html">
242
242
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
243
243
  </body>
@@ -56,7 +56,7 @@
56
56
  <a name="l00039"></a>00039 <span class="preprocessor"></span>
57
57
  <a name="l00040"></a>00040 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_HOOKS_H_ */</span>
58
58
  </pre></div></div>
59
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
59
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
60
60
  <a href="http://www.doxygen.org/index.html">
61
61
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
62
62
  </body>
@@ -129,7 +129,7 @@
129
129
  <a name="l00112"></a>00112 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_LOGGING_H_ */</span>
130
130
  <a name="l00113"></a>00113
131
131
  </pre></div></div>
132
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
132
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
133
133
  <a href="http://www.doxygen.org/index.html">
134
134
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
135
135
  </body>
@@ -517,7 +517,7 @@
517
517
  <a name="l00500"></a>00500
518
518
  <a name="l00501"></a>00501 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_MESSAGE_CHANNEL_H_ */</span>
519
519
  </pre></div></div>
520
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
520
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
521
521
  <a href="http://www.doxygen.org/index.html">
522
522
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
523
523
  </body>
@@ -586,7 +586,7 @@
586
586
  <a name="l00569"></a>00569
587
587
  <a name="l00570"></a>00570 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_SPAWN_MANAGER_H_ */</span>
588
588
  </pre></div></div>
589
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
589
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
590
590
  <a href="http://www.doxygen.org/index.html">
591
591
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
592
592
  </body>
@@ -466,266 +466,265 @@
466
466
  <a name="l00449"></a>00449 activeOrMaxChanged.notify_all();
467
467
  <a name="l00450"></a>00450 }
468
468
  <a name="l00451"></a>00451 } <span class="keywordflow">else</span> {
469
- <a name="l00452"></a>00452 <span class="keywordflow">while</span> (!(
470
- <a name="l00453"></a>00453 active &lt; max &amp;&amp;
471
- <a name="l00454"></a>00454 (maxPerApp == 0 || appInstanceCount[appRoot] &lt; maxPerApp)
472
- <a name="l00455"></a>00455 )) {
473
- <a name="l00456"></a>00456 activeOrMaxChanged.wait(l);
474
- <a name="l00457"></a>00457 }
475
- <a name="l00458"></a>00458 <span class="keywordflow">if</span> (count == max) {
476
- <a name="l00459"></a>00459 container = inactiveApps.front();
477
- <a name="l00460"></a>00460 inactiveApps.pop_front();
478
- <a name="l00461"></a>00461 list = apps[container-&gt;app-&gt;getAppRoot()].get();
479
- <a name="l00462"></a>00462 list-&gt;erase(container-&gt;iterator);
480
- <a name="l00463"></a>00463 <span class="keywordflow">if</span> (list-&gt;empty()) {
481
- <a name="l00464"></a>00464 apps.erase(container-&gt;app-&gt;getAppRoot());
482
- <a name="l00465"></a>00465 restartFileTimes.erase(container-&gt;app-&gt;getAppRoot());
483
- <a name="l00466"></a>00466 appInstanceCount.erase(container-&gt;app-&gt;getAppRoot());
484
- <a name="l00467"></a>00467 } <span class="keywordflow">else</span> {
485
- <a name="l00468"></a>00468 appInstanceCount[container-&gt;app-&gt;getAppRoot()]--;
486
- <a name="l00469"></a>00469 }
487
- <a name="l00470"></a>00470 count--;
488
- <a name="l00471"></a>00471 }
489
- <a name="l00472"></a>00472 container = <a class="code" href="group__Support.html#g41b6c4a82fed72531a147de0505a8396" title="Convenience shortcut for creating a shared_ptr.">ptr</a>(<span class="keyword">new</span> AppContainer());
490
- <a name="l00473"></a>00473 {
491
- <a name="l00474"></a>00474 this_thread::restore_interruption ri(di);
492
- <a name="l00475"></a>00475 <a class="code" href="classboost_1_1this__thread_1_1restore__syscall__interruption.html" title="Creating an object of this class on the stack will restore the system call interruption...">this_thread::restore_syscall_interruption</a> rsi(dsi);
493
- <a name="l00476"></a>00476 container-&gt;app = spawnManager.<a class="code" href="classPassenger_1_1SpawnManager.html#1bafa97204ea49a88b66272be3377d53" title="Spawn a new instance of a Ruby on Rails or Rack application.">spawn</a>(appRoot, lowerPrivilege, lowestUser,
494
- <a name="l00477"></a>00477 environment, spawnMethod, appType);
495
- <a name="l00478"></a>00478 }
496
- <a name="l00479"></a>00479 container-&gt;sessions = 0;
497
- <a name="l00480"></a>00480 it = apps.find(appRoot);
498
- <a name="l00481"></a>00481 <span class="keywordflow">if</span> (it == apps.end()) {
499
- <a name="l00482"></a>00482 list = <span class="keyword">new</span> AppContainerList();
500
- <a name="l00483"></a>00483 apps[appRoot] = <a class="code" href="group__Support.html#g41b6c4a82fed72531a147de0505a8396" title="Convenience shortcut for creating a shared_ptr.">ptr</a>(list);
501
- <a name="l00484"></a>00484 appInstanceCount[appRoot] = 1;
502
- <a name="l00485"></a>00485 } <span class="keywordflow">else</span> {
503
- <a name="l00486"></a>00486 list = it-&gt;second.get();
504
- <a name="l00487"></a>00487 appInstanceCount[appRoot]++;
505
- <a name="l00488"></a>00488 }
506
- <a name="l00489"></a>00489 list-&gt;push_back(container);
507
- <a name="l00490"></a>00490 container-&gt;iterator = list-&gt;end();
508
- <a name="l00491"></a>00491 container-&gt;iterator--;
509
- <a name="l00492"></a>00492 count++;
510
- <a name="l00493"></a>00493 active++;
511
- <a name="l00494"></a>00494 activeOrMaxChanged.notify_all();
512
- <a name="l00495"></a>00495 }
513
- <a name="l00496"></a>00496 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a> &amp;e) {
514
- <a name="l00497"></a>00497 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot spawn application '"</span>);
515
- <a name="l00498"></a>00498 message.append(appRoot);
516
- <a name="l00499"></a>00499 message.append(<span class="stringliteral">"': "</span>);
517
- <a name="l00500"></a>00500 message.append(e.<a class="code" href="classPassenger_1_1SpawnException.html#d2da180f89a43423a4b37248249972ff">what</a>());
518
- <a name="l00501"></a>00501 <span class="keywordflow">if</span> (e.<a class="code" href="classPassenger_1_1SpawnException.html#e65dc272e183fd9e5637a4091cc6bbf4" title="Check whether an error page is available.">hasErrorPage</a>()) {
519
- <a name="l00502"></a>00502 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message, e.<a class="code" href="classPassenger_1_1SpawnException.html#6f675a37edd7070875d0744e7dd010a1" title="Return the error page content.">getErrorPage</a>());
520
- <a name="l00503"></a>00503 } <span class="keywordflow">else</span> {
521
- <a name="l00504"></a>00504 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message);
522
- <a name="l00505"></a>00505 }
523
- <a name="l00506"></a>00506 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> exception &amp;e) {
524
- <a name="l00507"></a>00507 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot spawn application '"</span>);
525
- <a name="l00508"></a>00508 message.append(appRoot);
526
- <a name="l00509"></a>00509 message.append(<span class="stringliteral">"': "</span>);
527
- <a name="l00510"></a>00510 message.append(e.what());
528
- <a name="l00511"></a>00511 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message);
529
- <a name="l00512"></a>00512 }
530
- <a name="l00513"></a>00513
531
- <a name="l00514"></a>00514 <span class="keywordflow">return</span> make_pair(container, list);
532
- <a name="l00515"></a>00515 }
533
- <a name="l00516"></a>00516
534
- <a name="l00517"></a>00517 <span class="keyword">public</span>:<span class="comment"></span>
535
- <a name="l00518"></a>00518 <span class="comment"> /**</span>
536
- <a name="l00519"></a>00519 <span class="comment"> * Create a new StandardApplicationPool object.</span>
537
- <a name="l00520"></a>00520 <span class="comment"> *</span>
538
- <a name="l00521"></a>00521 <span class="comment"> * @param spawnServerCommand The filename of the spawn server to use.</span>
539
- <a name="l00522"></a>00522 <span class="comment"> * @param logFile Specify a log file that the spawn server should use.</span>
540
- <a name="l00523"></a>00523 <span class="comment"> * Messages on its standard output and standard error channels</span>
541
- <a name="l00524"></a>00524 <span class="comment"> * will be written to this log file. If an empty string is</span>
542
- <a name="l00525"></a>00525 <span class="comment"> * specified, no log file will be used, and the spawn server</span>
543
- <a name="l00526"></a>00526 <span class="comment"> * will use the same standard output/error channels as the</span>
544
- <a name="l00527"></a>00527 <span class="comment"> * current process.</span>
545
- <a name="l00528"></a>00528 <span class="comment"> * @param rubyCommand The Ruby interpreter's command.</span>
546
- <a name="l00529"></a>00529 <span class="comment"> * @param user The user that the spawn manager should run as. This</span>
547
- <a name="l00530"></a>00530 <span class="comment"> * parameter only has effect if the current process is</span>
548
- <a name="l00531"></a>00531 <span class="comment"> * running as root. If the empty string is given, or if</span>
549
- <a name="l00532"></a>00532 <span class="comment"> * the &lt;tt&gt;user&lt;/tt&gt; is not a valid username, then</span>
550
- <a name="l00533"></a>00533 <span class="comment"> * the spawn manager will be run as the current user.</span>
551
- <a name="l00534"></a>00534 <span class="comment"> * @param rubyCommand The Ruby interpreter's command.</span>
552
- <a name="l00535"></a>00535 <span class="comment"> * @throws SystemException An error occured while trying to setup the spawn server.</span>
553
- <a name="l00536"></a>00536 <span class="comment"> * @throws IOException The specified log file could not be opened.</span>
554
- <a name="l00537"></a>00537 <span class="comment"> */</span>
555
- <a name="l00538"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#f175704fc477f37ba1d387be09fa2e6b">00538</a> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#f175704fc477f37ba1d387be09fa2e6b" title="Create a new StandardApplicationPool object.">StandardApplicationPool</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spawnServerCommand,
556
- <a name="l00539"></a>00539 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;logFile = <span class="stringliteral">""</span>,
557
- <a name="l00540"></a>00540 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;rubyCommand = <span class="stringliteral">"ruby"</span>,
558
- <a name="l00541"></a>00541 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;user = <span class="stringliteral">""</span>)
559
- <a name="l00542"></a>00542 :
560
- <a name="l00543"></a>00543 #ifndef PASSENGER_USE_DUMMY_SPAWN_MANAGER
561
- <a name="l00544"></a>00544 spawnManager(spawnServerCommand, logFile, rubyCommand, user),
562
- <a name="l00545"></a>00545 #endif
563
- <a name="l00546"></a>00546 data(new SharedData()),
564
- <a name="l00547"></a>00547 lock(data-&gt;lock),
565
- <a name="l00548"></a>00548 activeOrMaxChanged(data-&gt;activeOrMaxChanged),
566
- <a name="l00549"></a>00549 apps(data-&gt;apps),
567
- <a name="l00550"></a>00550 max(data-&gt;max),
568
- <a name="l00551"></a>00551 count(data-&gt;count),
569
- <a name="l00552"></a>00552 active(data-&gt;active),
570
- <a name="l00553"></a>00553 maxPerApp(data-&gt;maxPerApp),
571
- <a name="l00554"></a>00554 inactiveApps(data-&gt;inactiveApps),
572
- <a name="l00555"></a>00555 restartFileTimes(data-&gt;restartFileTimes),
573
- <a name="l00556"></a>00556 appInstanceCount(data-&gt;appInstanceCount)
574
- <a name="l00557"></a>00557 {
575
- <a name="l00558"></a>00558 detached = <span class="keyword">false</span>;
576
- <a name="l00559"></a>00559 done = <span class="keyword">false</span>;
577
- <a name="l00560"></a>00560 max = DEFAULT_MAX_POOL_SIZE;
578
- <a name="l00561"></a>00561 count = 0;
579
- <a name="l00562"></a>00562 active = 0;
580
- <a name="l00563"></a>00563 useGlobalQueue = <span class="keyword">false</span>;
581
- <a name="l00564"></a>00564 waitingOnGlobalQueue = 0;
582
- <a name="l00565"></a>00565 maxPerApp = DEFAULT_MAX_INSTANCES_PER_APP;
583
- <a name="l00566"></a>00566 maxIdleTime = DEFAULT_MAX_IDLE_TIME;
584
- <a name="l00567"></a>00567 cleanerThread = <span class="keyword">new</span> thread(
585
- <a name="l00568"></a>00568 bind(&amp;StandardApplicationPool::cleanerThreadMainLoop, <span class="keyword">this</span>),
586
- <a name="l00569"></a>00569 CLEANER_THREAD_STACK_SIZE
587
- <a name="l00570"></a>00570 );
588
- <a name="l00571"></a>00571 }
589
- <a name="l00572"></a>00572
590
- <a name="l00573"></a>00573 <span class="keyword">virtual</span> ~<a class="code" href="classPassenger_1_1StandardApplicationPool.html" title="A standard implementation of ApplicationPool for single-process environments.">StandardApplicationPool</a>() {
591
- <a name="l00574"></a>00574 <span class="keywordflow">if</span> (!detached) {
592
- <a name="l00575"></a>00575 this_thread::disable_interruption di;
593
- <a name="l00576"></a>00576 {
594
- <a name="l00577"></a>00577 mutex::scoped_lock l(lock);
595
- <a name="l00578"></a>00578 done = <span class="keyword">true</span>;
596
- <a name="l00579"></a>00579 cleanerThreadSleeper.notify_one();
597
- <a name="l00580"></a>00580 }
598
- <a name="l00581"></a>00581 cleanerThread-&gt;join();
599
- <a name="l00582"></a>00582 }
600
- <a name="l00583"></a>00583 <span class="keyword">delete</span> cleanerThread;
601
- <a name="l00584"></a>00584 }
602
- <a name="l00585"></a>00585
603
- <a name="l00586"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#0dcdd88c39d7f1a1d667e24c3cb9b243">00586</a> <span class="keyword">virtual</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a> <span class="keyword">get</span>(
604
- <a name="l00587"></a>00587 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;appRoot,
605
- <a name="l00588"></a>00588 <span class="keywordtype">bool</span> lowerPrivilege = <span class="keyword">true</span>,
606
- <a name="l00589"></a>00589 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;lowestUser = <span class="stringliteral">"nobody"</span>,
607
- <a name="l00590"></a>00590 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;environment = <span class="stringliteral">"production"</span>,
608
- <a name="l00591"></a>00591 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spawnMethod = <span class="stringliteral">"smart"</span>,
609
- <a name="l00592"></a>00592 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;appType = <span class="stringliteral">"rails"</span>
610
- <a name="l00593"></a>00593 ) {
611
- <a name="l00594"></a>00594 <span class="keyword">using namespace </span>boost::posix_time;
612
- <a name="l00595"></a>00595 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> attempt = 0;
613
- <a name="l00596"></a>00596 ptime timeLimit(get_system_time() + millisec(GET_TIMEOUT));
614
- <a name="l00597"></a>00597 unique_lock&lt;mutex&gt; l(lock);
615
- <a name="l00598"></a>00598
616
- <a name="l00599"></a>00599 <span class="keywordflow">while</span> (<span class="keyword">true</span>) {
617
- <a name="l00600"></a>00600 attempt++;
618
- <a name="l00601"></a>00601
619
- <a name="l00602"></a>00602 pair&lt;AppContainerPtr, AppContainerList *&gt; p(
620
- <a name="l00603"></a>00603 spawnOrUseExisting(l, appRoot, lowerPrivilege, lowestUser,
621
- <a name="l00604"></a>00604 environment, spawnMethod, appType)
622
- <a name="l00605"></a>00605 );
623
- <a name="l00606"></a>00606 AppContainerPtr &amp;container(p.first);
624
- <a name="l00607"></a>00607 AppContainerList &amp;list(*p.second);
625
- <a name="l00608"></a>00608
626
- <a name="l00609"></a>00609 container-&gt;lastUsed = time(NULL);
627
- <a name="l00610"></a>00610 container-&gt;sessions++;
628
- <a name="l00611"></a>00611
629
- <a name="l00612"></a>00612 P_ASSERT(verifyState(), <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>(),
630
- <a name="l00613"></a>00613 <span class="stringliteral">"State is valid:\n"</span> &lt;&lt; <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(<span class="keyword">false</span>));
631
- <a name="l00614"></a>00614 <span class="keywordflow">try</span> {
632
- <a name="l00615"></a>00615 <span class="keywordflow">return</span> container-&gt;app-&gt;connect(SessionCloseCallback(data, container));
633
- <a name="l00616"></a>00616 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> exception &amp;e) {
634
- <a name="l00617"></a>00617 container-&gt;sessions--;
635
- <a name="l00618"></a>00618 <span class="keywordflow">if</span> (attempt == MAX_GET_ATTEMPTS) {
636
- <a name="l00619"></a>00619 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot connect to an existing "</span>
637
- <a name="l00620"></a>00620 <span class="stringliteral">"application instance for '"</span>);
638
- <a name="l00621"></a>00621 message.append(appRoot);
639
- <a name="l00622"></a>00622 message.append(<span class="stringliteral">"': "</span>);
640
- <a name="l00623"></a>00623 <span class="keywordflow">try</span> {
641
- <a name="l00624"></a>00624 <span class="keyword">const</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> &amp;syse =
642
- <a name="l00625"></a>00625 <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> &amp;<span class="keyword">&gt;</span>(e);
643
- <a name="l00626"></a>00626 message.append(syse.<a class="code" href="classPassenger_1_1SystemException.html#0ef41d755fea2c9b1db2252e7c418dc8" title="Returns the system&amp;#39;s error message.">sys</a>());
644
- <a name="l00627"></a>00627 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> bad_cast &amp;) {
645
- <a name="l00628"></a>00628 message.append(e.what());
646
- <a name="l00629"></a>00629 }
647
- <a name="l00630"></a>00630 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(message);
648
- <a name="l00631"></a>00631 } <span class="keywordflow">else</span> {
649
- <a name="l00632"></a>00632 list.erase(container-&gt;iterator);
650
- <a name="l00633"></a>00633 <span class="keywordflow">if</span> (list.empty()) {
651
- <a name="l00634"></a>00634 apps.erase(appRoot);
652
- <a name="l00635"></a>00635 appInstanceCount.erase(appRoot);
653
- <a name="l00636"></a>00636 }
654
- <a name="l00637"></a>00637 count--;
655
- <a name="l00638"></a>00638 active--;
656
- <a name="l00639"></a>00639 activeOrMaxChanged.notify_all();
657
- <a name="l00640"></a>00640 P_ASSERT(verifyState(), <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>(),
658
- <a name="l00641"></a>00641 <span class="stringliteral">"State is valid."</span>);
659
- <a name="l00642"></a>00642 }
660
- <a name="l00643"></a>00643 }
661
- <a name="l00644"></a>00644 }
662
- <a name="l00645"></a>00645 <span class="comment">// Never reached; shut up compiler warning</span>
663
- <a name="l00646"></a>00646 <span class="keywordflow">return</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>();
664
- <a name="l00647"></a>00647 }
665
- <a name="l00648"></a>00648
666
- <a name="l00649"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#bcf8faeb4f431ae07ea0e20270661d08">00649</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#bcf8faeb4f431ae07ea0e20270661d08" title="Clear all application instances that are currently in the pool.">clear</a>() {
667
- <a name="l00650"></a>00650 mutex::scoped_lock l(lock);
668
- <a name="l00651"></a>00651 apps.clear();
669
- <a name="l00652"></a>00652 inactiveApps.clear();
670
- <a name="l00653"></a>00653 restartFileTimes.clear();
671
- <a name="l00654"></a>00654 appInstanceCount.clear();
672
- <a name="l00655"></a>00655 count = 0;
673
- <a name="l00656"></a>00656 active = 0;
674
- <a name="l00657"></a>00657 }
675
- <a name="l00658"></a>00658
676
- <a name="l00659"></a>00659 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setMaxIdleTime(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seconds) {
677
- <a name="l00660"></a>00660 mutex::scoped_lock l(lock);
678
- <a name="l00661"></a>00661 maxIdleTime = seconds;
679
- <a name="l00662"></a>00662 cleanerThreadSleeper.notify_one();
680
- <a name="l00663"></a>00663 }
681
- <a name="l00664"></a>00664
682
- <a name="l00665"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#04ef8c92da189520ad2022f4f82e9553">00665</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#04ef8c92da189520ad2022f4f82e9553" title="Set a hard limit on the number of application instances that this ApplicationPool...">setMax</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max) {
683
- <a name="l00666"></a>00666 mutex::scoped_lock l(lock);
684
- <a name="l00667"></a>00667 this-&gt;max = max;
685
- <a name="l00668"></a>00668 activeOrMaxChanged.notify_all();
686
- <a name="l00669"></a>00669 }
687
- <a name="l00670"></a>00670
688
- <a name="l00671"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#7773c4a3dfbd88eac72401d063831788">00671</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#7773c4a3dfbd88eac72401d063831788" title="Get the number of active applications in the pool.">getActive</a>()<span class="keyword"> const </span>{
689
- <a name="l00672"></a>00672 <span class="keywordflow">return</span> active;
690
- <a name="l00673"></a>00673 }
691
- <a name="l00674"></a>00674
692
- <a name="l00675"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#cdbfe2b9ffacdab4438c879c2411bf02">00675</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#cdbfe2b9ffacdab4438c879c2411bf02" title="Get the number of active applications in the pool.">getCount</a>()<span class="keyword"> const </span>{
693
- <a name="l00676"></a>00676 <span class="keywordflow">return</span> count;
694
- <a name="l00677"></a>00677 }
695
- <a name="l00678"></a>00678
696
- <a name="l00679"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#3bafcda8d880f70561ad8a9da16e26ef">00679</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#3bafcda8d880f70561ad8a9da16e26ef" title="Set a hard limit on the number of application instances that a single application...">setMaxPerApp</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxPerApp) {
697
- <a name="l00680"></a>00680 mutex::scoped_lock l(lock);
698
- <a name="l00681"></a>00681 this-&gt;maxPerApp = maxPerApp;
699
- <a name="l00682"></a>00682 activeOrMaxChanged.notify_all();
700
- <a name="l00683"></a>00683 }
701
- <a name="l00684"></a>00684
702
- <a name="l00685"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#e9c699b56f3a755ab10269c7fe585c2d">00685</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#e9c699b56f3a755ab10269c7fe585c2d" title="Sets whether to use a global queue instead of a per-backend process queue.">setUseGlobalQueue</a>(<span class="keywordtype">bool</span> value) {
703
- <a name="l00686"></a>00686 this-&gt;useGlobalQueue = value;
704
- <a name="l00687"></a>00687 }
705
- <a name="l00688"></a>00688
706
- <a name="l00689"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#6955152d237920988d20297d2fff5660">00689</a> <span class="keyword">virtual</span> pid_t <a class="code" href="classPassenger_1_1StandardApplicationPool.html#6955152d237920988d20297d2fff5660" title="Get the process ID of the spawn server that is used.">getSpawnServerPid</a>()<span class="keyword"> const </span>{
707
- <a name="l00690"></a>00690 <span class="keywordflow">return</span> spawnManager.<a class="code" href="classPassenger_1_1SpawnManager.html#1f77e2e7e6cb464028c13a29f983ad8e" title="Get the Process ID of the spawn server.">getServerPid</a>();
708
- <a name="l00691"></a>00691 }
709
- <a name="l00692"></a>00692 <span class="comment"></span>
710
- <a name="l00693"></a>00693 <span class="comment"> /**</span>
711
- <a name="l00694"></a>00694 <span class="comment"> * Returns a textual description of the internal state of</span>
712
- <a name="l00695"></a>00695 <span class="comment"> * the application pool.</span>
713
- <a name="l00696"></a>00696 <span class="comment"> */</span>
714
- <a name="l00697"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#22b4149ca8256c3042fc342e681b0383">00697</a> <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(<span class="keywordtype">bool</span> lockMutex = <span class="keyword">true</span>)<span class="keyword"> const </span>{
715
- <a name="l00698"></a>00698 <span class="keywordflow">if</span> (lockMutex) {
716
- <a name="l00699"></a>00699 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(boost::adopt_lock);
717
- <a name="l00700"></a>00700 } <span class="keywordflow">else</span> {
718
- <a name="l00701"></a>00701 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(boost::defer_lock);
719
- <a name="l00702"></a>00702 }
720
- <a name="l00703"></a>00703 }
721
- <a name="l00704"></a>00704 };
722
- <a name="l00705"></a>00705
723
- <a name="l00706"></a>00706 } <span class="comment">// namespace Passenger</span>
724
- <a name="l00707"></a>00707
725
- <a name="l00708"></a>00708 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_STANDARD_APPLICATION_POOL_H_ */</span>
726
- <a name="l00709"></a>00709
469
+ <a name="l00452"></a>00452 <span class="keywordflow">if</span> (active &gt;= max) {
470
+ <a name="l00453"></a>00453 activeOrMaxChanged.wait(l);
471
+ <a name="l00454"></a>00454 <span class="keywordflow">goto</span> beginning_of_function;
472
+ <a name="l00455"></a>00455 }
473
+ <a name="l00456"></a>00456 <span class="keywordflow">if</span> (count == max) {
474
+ <a name="l00457"></a>00457 container = inactiveApps.front();
475
+ <a name="l00458"></a>00458 inactiveApps.pop_front();
476
+ <a name="l00459"></a>00459 list = apps[container-&gt;app-&gt;getAppRoot()].get();
477
+ <a name="l00460"></a>00460 list-&gt;erase(container-&gt;iterator);
478
+ <a name="l00461"></a>00461 <span class="keywordflow">if</span> (list-&gt;empty()) {
479
+ <a name="l00462"></a>00462 apps.erase(container-&gt;app-&gt;getAppRoot());
480
+ <a name="l00463"></a>00463 restartFileTimes.erase(container-&gt;app-&gt;getAppRoot());
481
+ <a name="l00464"></a>00464 appInstanceCount.erase(container-&gt;app-&gt;getAppRoot());
482
+ <a name="l00465"></a>00465 } <span class="keywordflow">else</span> {
483
+ <a name="l00466"></a>00466 appInstanceCount[container-&gt;app-&gt;getAppRoot()]--;
484
+ <a name="l00467"></a>00467 }
485
+ <a name="l00468"></a>00468 count--;
486
+ <a name="l00469"></a>00469 }
487
+ <a name="l00470"></a>00470 container = <a class="code" href="group__Support.html#g41b6c4a82fed72531a147de0505a8396" title="Convenience shortcut for creating a shared_ptr.">ptr</a>(<span class="keyword">new</span> AppContainer());
488
+ <a name="l00471"></a>00471 {
489
+ <a name="l00472"></a>00472 this_thread::restore_interruption ri(di);
490
+ <a name="l00473"></a>00473 <a class="code" href="classboost_1_1this__thread_1_1restore__syscall__interruption.html" title="Creating an object of this class on the stack will restore the system call interruption...">this_thread::restore_syscall_interruption</a> rsi(dsi);
491
+ <a name="l00474"></a>00474 container-&gt;app = spawnManager.<a class="code" href="classPassenger_1_1SpawnManager.html#1bafa97204ea49a88b66272be3377d53" title="Spawn a new instance of a Ruby on Rails or Rack application.">spawn</a>(appRoot, lowerPrivilege, lowestUser,
492
+ <a name="l00475"></a>00475 environment, spawnMethod, appType);
493
+ <a name="l00476"></a>00476 }
494
+ <a name="l00477"></a>00477 container-&gt;sessions = 0;
495
+ <a name="l00478"></a>00478 it = apps.find(appRoot);
496
+ <a name="l00479"></a>00479 <span class="keywordflow">if</span> (it == apps.end()) {
497
+ <a name="l00480"></a>00480 list = <span class="keyword">new</span> AppContainerList();
498
+ <a name="l00481"></a>00481 apps[appRoot] = <a class="code" href="group__Support.html#g41b6c4a82fed72531a147de0505a8396" title="Convenience shortcut for creating a shared_ptr.">ptr</a>(list);
499
+ <a name="l00482"></a>00482 appInstanceCount[appRoot] = 1;
500
+ <a name="l00483"></a>00483 } <span class="keywordflow">else</span> {
501
+ <a name="l00484"></a>00484 list = it-&gt;second.get();
502
+ <a name="l00485"></a>00485 appInstanceCount[appRoot]++;
503
+ <a name="l00486"></a>00486 }
504
+ <a name="l00487"></a>00487 list-&gt;push_back(container);
505
+ <a name="l00488"></a>00488 container-&gt;iterator = list-&gt;end();
506
+ <a name="l00489"></a>00489 container-&gt;iterator--;
507
+ <a name="l00490"></a>00490 count++;
508
+ <a name="l00491"></a>00491 active++;
509
+ <a name="l00492"></a>00492 activeOrMaxChanged.notify_all();
510
+ <a name="l00493"></a>00493 }
511
+ <a name="l00494"></a>00494 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a> &amp;e) {
512
+ <a name="l00495"></a>00495 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot spawn application '"</span>);
513
+ <a name="l00496"></a>00496 message.append(appRoot);
514
+ <a name="l00497"></a>00497 message.append(<span class="stringliteral">"': "</span>);
515
+ <a name="l00498"></a>00498 message.append(e.<a class="code" href="classPassenger_1_1SpawnException.html#d2da180f89a43423a4b37248249972ff">what</a>());
516
+ <a name="l00499"></a>00499 <span class="keywordflow">if</span> (e.<a class="code" href="classPassenger_1_1SpawnException.html#e65dc272e183fd9e5637a4091cc6bbf4" title="Check whether an error page is available.">hasErrorPage</a>()) {
517
+ <a name="l00500"></a>00500 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message, e.<a class="code" href="classPassenger_1_1SpawnException.html#6f675a37edd7070875d0744e7dd010a1" title="Return the error page content.">getErrorPage</a>());
518
+ <a name="l00501"></a>00501 } <span class="keywordflow">else</span> {
519
+ <a name="l00502"></a>00502 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message);
520
+ <a name="l00503"></a>00503 }
521
+ <a name="l00504"></a>00504 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> exception &amp;e) {
522
+ <a name="l00505"></a>00505 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot spawn application '"</span>);
523
+ <a name="l00506"></a>00506 message.append(appRoot);
524
+ <a name="l00507"></a>00507 message.append(<span class="stringliteral">"': "</span>);
525
+ <a name="l00508"></a>00508 message.append(e.what());
526
+ <a name="l00509"></a>00509 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SpawnException.html" title="Thrown when SpawnManager or ApplicationPool fails to spawn an application instance...">SpawnException</a>(message);
527
+ <a name="l00510"></a>00510 }
528
+ <a name="l00511"></a>00511
529
+ <a name="l00512"></a>00512 <span class="keywordflow">return</span> make_pair(container, list);
530
+ <a name="l00513"></a>00513 }
531
+ <a name="l00514"></a>00514
532
+ <a name="l00515"></a>00515 <span class="keyword">public</span>:<span class="comment"></span>
533
+ <a name="l00516"></a>00516 <span class="comment"> /**</span>
534
+ <a name="l00517"></a>00517 <span class="comment"> * Create a new StandardApplicationPool object.</span>
535
+ <a name="l00518"></a>00518 <span class="comment"> *</span>
536
+ <a name="l00519"></a>00519 <span class="comment"> * @param spawnServerCommand The filename of the spawn server to use.</span>
537
+ <a name="l00520"></a>00520 <span class="comment"> * @param logFile Specify a log file that the spawn server should use.</span>
538
+ <a name="l00521"></a>00521 <span class="comment"> * Messages on its standard output and standard error channels</span>
539
+ <a name="l00522"></a>00522 <span class="comment"> * will be written to this log file. If an empty string is</span>
540
+ <a name="l00523"></a>00523 <span class="comment"> * specified, no log file will be used, and the spawn server</span>
541
+ <a name="l00524"></a>00524 <span class="comment"> * will use the same standard output/error channels as the</span>
542
+ <a name="l00525"></a>00525 <span class="comment"> * current process.</span>
543
+ <a name="l00526"></a>00526 <span class="comment"> * @param rubyCommand The Ruby interpreter's command.</span>
544
+ <a name="l00527"></a>00527 <span class="comment"> * @param user The user that the spawn manager should run as. This</span>
545
+ <a name="l00528"></a>00528 <span class="comment"> * parameter only has effect if the current process is</span>
546
+ <a name="l00529"></a>00529 <span class="comment"> * running as root. If the empty string is given, or if</span>
547
+ <a name="l00530"></a>00530 <span class="comment"> * the &lt;tt&gt;user&lt;/tt&gt; is not a valid username, then</span>
548
+ <a name="l00531"></a>00531 <span class="comment"> * the spawn manager will be run as the current user.</span>
549
+ <a name="l00532"></a>00532 <span class="comment"> * @param rubyCommand The Ruby interpreter's command.</span>
550
+ <a name="l00533"></a>00533 <span class="comment"> * @throws SystemException An error occured while trying to setup the spawn server.</span>
551
+ <a name="l00534"></a>00534 <span class="comment"> * @throws IOException The specified log file could not be opened.</span>
552
+ <a name="l00535"></a>00535 <span class="comment"> */</span>
553
+ <a name="l00536"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#f175704fc477f37ba1d387be09fa2e6b">00536</a> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#f175704fc477f37ba1d387be09fa2e6b" title="Create a new StandardApplicationPool object.">StandardApplicationPool</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spawnServerCommand,
554
+ <a name="l00537"></a>00537 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;logFile = <span class="stringliteral">""</span>,
555
+ <a name="l00538"></a>00538 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;rubyCommand = <span class="stringliteral">"ruby"</span>,
556
+ <a name="l00539"></a>00539 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;user = <span class="stringliteral">""</span>)
557
+ <a name="l00540"></a>00540 :
558
+ <a name="l00541"></a>00541 #ifndef PASSENGER_USE_DUMMY_SPAWN_MANAGER
559
+ <a name="l00542"></a>00542 spawnManager(spawnServerCommand, logFile, rubyCommand, user),
560
+ <a name="l00543"></a>00543 #endif
561
+ <a name="l00544"></a>00544 data(new SharedData()),
562
+ <a name="l00545"></a>00545 lock(data-&gt;lock),
563
+ <a name="l00546"></a>00546 activeOrMaxChanged(data-&gt;activeOrMaxChanged),
564
+ <a name="l00547"></a>00547 apps(data-&gt;apps),
565
+ <a name="l00548"></a>00548 max(data-&gt;max),
566
+ <a name="l00549"></a>00549 count(data-&gt;count),
567
+ <a name="l00550"></a>00550 active(data-&gt;active),
568
+ <a name="l00551"></a>00551 maxPerApp(data-&gt;maxPerApp),
569
+ <a name="l00552"></a>00552 inactiveApps(data-&gt;inactiveApps),
570
+ <a name="l00553"></a>00553 restartFileTimes(data-&gt;restartFileTimes),
571
+ <a name="l00554"></a>00554 appInstanceCount(data-&gt;appInstanceCount)
572
+ <a name="l00555"></a>00555 {
573
+ <a name="l00556"></a>00556 detached = <span class="keyword">false</span>;
574
+ <a name="l00557"></a>00557 done = <span class="keyword">false</span>;
575
+ <a name="l00558"></a>00558 max = DEFAULT_MAX_POOL_SIZE;
576
+ <a name="l00559"></a>00559 count = 0;
577
+ <a name="l00560"></a>00560 active = 0;
578
+ <a name="l00561"></a>00561 useGlobalQueue = <span class="keyword">false</span>;
579
+ <a name="l00562"></a>00562 waitingOnGlobalQueue = 0;
580
+ <a name="l00563"></a>00563 maxPerApp = DEFAULT_MAX_INSTANCES_PER_APP;
581
+ <a name="l00564"></a>00564 maxIdleTime = DEFAULT_MAX_IDLE_TIME;
582
+ <a name="l00565"></a>00565 cleanerThread = <span class="keyword">new</span> thread(
583
+ <a name="l00566"></a>00566 bind(&amp;StandardApplicationPool::cleanerThreadMainLoop, <span class="keyword">this</span>),
584
+ <a name="l00567"></a>00567 CLEANER_THREAD_STACK_SIZE
585
+ <a name="l00568"></a>00568 );
586
+ <a name="l00569"></a>00569 }
587
+ <a name="l00570"></a>00570
588
+ <a name="l00571"></a>00571 <span class="keyword">virtual</span> ~<a class="code" href="classPassenger_1_1StandardApplicationPool.html" title="A standard implementation of ApplicationPool for single-process environments.">StandardApplicationPool</a>() {
589
+ <a name="l00572"></a>00572 <span class="keywordflow">if</span> (!detached) {
590
+ <a name="l00573"></a>00573 this_thread::disable_interruption di;
591
+ <a name="l00574"></a>00574 {
592
+ <a name="l00575"></a>00575 mutex::scoped_lock l(lock);
593
+ <a name="l00576"></a>00576 done = <span class="keyword">true</span>;
594
+ <a name="l00577"></a>00577 cleanerThreadSleeper.notify_one();
595
+ <a name="l00578"></a>00578 }
596
+ <a name="l00579"></a>00579 cleanerThread-&gt;join();
597
+ <a name="l00580"></a>00580 }
598
+ <a name="l00581"></a>00581 <span class="keyword">delete</span> cleanerThread;
599
+ <a name="l00582"></a>00582 }
600
+ <a name="l00583"></a>00583
601
+ <a name="l00584"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#0dcdd88c39d7f1a1d667e24c3cb9b243">00584</a> <span class="keyword">virtual</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a> <span class="keyword">get</span>(
602
+ <a name="l00585"></a>00585 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;appRoot,
603
+ <a name="l00586"></a>00586 <span class="keywordtype">bool</span> lowerPrivilege = <span class="keyword">true</span>,
604
+ <a name="l00587"></a>00587 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;lowestUser = <span class="stringliteral">"nobody"</span>,
605
+ <a name="l00588"></a>00588 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;environment = <span class="stringliteral">"production"</span>,
606
+ <a name="l00589"></a>00589 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spawnMethod = <span class="stringliteral">"smart"</span>,
607
+ <a name="l00590"></a>00590 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;appType = <span class="stringliteral">"rails"</span>
608
+ <a name="l00591"></a>00591 ) {
609
+ <a name="l00592"></a>00592 <span class="keyword">using namespace </span>boost::posix_time;
610
+ <a name="l00593"></a>00593 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> attempt = 0;
611
+ <a name="l00594"></a>00594 ptime timeLimit(get_system_time() + millisec(GET_TIMEOUT));
612
+ <a name="l00595"></a>00595 unique_lock&lt;mutex&gt; l(lock);
613
+ <a name="l00596"></a>00596
614
+ <a name="l00597"></a>00597 <span class="keywordflow">while</span> (<span class="keyword">true</span>) {
615
+ <a name="l00598"></a>00598 attempt++;
616
+ <a name="l00599"></a>00599
617
+ <a name="l00600"></a>00600 pair&lt;AppContainerPtr, AppContainerList *&gt; p(
618
+ <a name="l00601"></a>00601 spawnOrUseExisting(l, appRoot, lowerPrivilege, lowestUser,
619
+ <a name="l00602"></a>00602 environment, spawnMethod, appType)
620
+ <a name="l00603"></a>00603 );
621
+ <a name="l00604"></a>00604 AppContainerPtr &amp;container(p.first);
622
+ <a name="l00605"></a>00605 AppContainerList &amp;list(*p.second);
623
+ <a name="l00606"></a>00606
624
+ <a name="l00607"></a>00607 container-&gt;lastUsed = time(NULL);
625
+ <a name="l00608"></a>00608 container-&gt;sessions++;
626
+ <a name="l00609"></a>00609
627
+ <a name="l00610"></a>00610 P_ASSERT(verifyState(), <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>(),
628
+ <a name="l00611"></a>00611 <span class="stringliteral">"State is valid:\n"</span> &lt;&lt; <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(<span class="keyword">false</span>));
629
+ <a name="l00612"></a>00612 <span class="keywordflow">try</span> {
630
+ <a name="l00613"></a>00613 <span class="keywordflow">return</span> container-&gt;app-&gt;connect(SessionCloseCallback(data, container));
631
+ <a name="l00614"></a>00614 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> exception &amp;e) {
632
+ <a name="l00615"></a>00615 container-&gt;sessions--;
633
+ <a name="l00616"></a>00616 <span class="keywordflow">if</span> (attempt == MAX_GET_ATTEMPTS) {
634
+ <a name="l00617"></a>00617 <span class="keywordtype">string</span> message(<span class="stringliteral">"Cannot connect to an existing "</span>
635
+ <a name="l00618"></a>00618 <span class="stringliteral">"application instance for '"</span>);
636
+ <a name="l00619"></a>00619 message.append(appRoot);
637
+ <a name="l00620"></a>00620 message.append(<span class="stringliteral">"': "</span>);
638
+ <a name="l00621"></a>00621 <span class="keywordflow">try</span> {
639
+ <a name="l00622"></a>00622 <span class="keyword">const</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> &amp;syse =
640
+ <a name="l00623"></a>00623 <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> &amp;<span class="keyword">&gt;</span>(e);
641
+ <a name="l00624"></a>00624 message.append(syse.<a class="code" href="classPassenger_1_1SystemException.html#0ef41d755fea2c9b1db2252e7c418dc8" title="Returns the system&amp;#39;s error message.">sys</a>());
642
+ <a name="l00625"></a>00625 } <span class="keywordflow">catch</span> (<span class="keyword">const</span> bad_cast &amp;) {
643
+ <a name="l00626"></a>00626 message.append(e.what());
644
+ <a name="l00627"></a>00627 }
645
+ <a name="l00628"></a>00628 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(message);
646
+ <a name="l00629"></a>00629 } <span class="keywordflow">else</span> {
647
+ <a name="l00630"></a>00630 list.erase(container-&gt;iterator);
648
+ <a name="l00631"></a>00631 <span class="keywordflow">if</span> (list.empty()) {
649
+ <a name="l00632"></a>00632 apps.erase(appRoot);
650
+ <a name="l00633"></a>00633 appInstanceCount.erase(appRoot);
651
+ <a name="l00634"></a>00634 }
652
+ <a name="l00635"></a>00635 count--;
653
+ <a name="l00636"></a>00636 active--;
654
+ <a name="l00637"></a>00637 activeOrMaxChanged.notify_all();
655
+ <a name="l00638"></a>00638 P_ASSERT(verifyState(), <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>(),
656
+ <a name="l00639"></a>00639 <span class="stringliteral">"State is valid."</span>);
657
+ <a name="l00640"></a>00640 }
658
+ <a name="l00641"></a>00641 }
659
+ <a name="l00642"></a>00642 }
660
+ <a name="l00643"></a>00643 <span class="comment">// Never reached; shut up compiler warning</span>
661
+ <a name="l00644"></a>00644 <span class="keywordflow">return</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a>();
662
+ <a name="l00645"></a>00645 }
663
+ <a name="l00646"></a>00646
664
+ <a name="l00647"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#bcf8faeb4f431ae07ea0e20270661d08">00647</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#bcf8faeb4f431ae07ea0e20270661d08" title="Clear all application instances that are currently in the pool.">clear</a>() {
665
+ <a name="l00648"></a>00648 mutex::scoped_lock l(lock);
666
+ <a name="l00649"></a>00649 apps.clear();
667
+ <a name="l00650"></a>00650 inactiveApps.clear();
668
+ <a name="l00651"></a>00651 restartFileTimes.clear();
669
+ <a name="l00652"></a>00652 appInstanceCount.clear();
670
+ <a name="l00653"></a>00653 count = 0;
671
+ <a name="l00654"></a>00654 active = 0;
672
+ <a name="l00655"></a>00655 activeOrMaxChanged.notify_all();
673
+ <a name="l00656"></a>00656 }
674
+ <a name="l00657"></a>00657
675
+ <a name="l00658"></a>00658 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setMaxIdleTime(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seconds) {
676
+ <a name="l00659"></a>00659 mutex::scoped_lock l(lock);
677
+ <a name="l00660"></a>00660 maxIdleTime = seconds;
678
+ <a name="l00661"></a>00661 cleanerThreadSleeper.notify_one();
679
+ <a name="l00662"></a>00662 }
680
+ <a name="l00663"></a>00663
681
+ <a name="l00664"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#04ef8c92da189520ad2022f4f82e9553">00664</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#04ef8c92da189520ad2022f4f82e9553" title="Set a hard limit on the number of application instances that this ApplicationPool...">setMax</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max) {
682
+ <a name="l00665"></a>00665 mutex::scoped_lock l(lock);
683
+ <a name="l00666"></a>00666 this-&gt;max = max;
684
+ <a name="l00667"></a>00667 activeOrMaxChanged.notify_all();
685
+ <a name="l00668"></a>00668 }
686
+ <a name="l00669"></a>00669
687
+ <a name="l00670"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#7773c4a3dfbd88eac72401d063831788">00670</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#7773c4a3dfbd88eac72401d063831788" title="Get the number of active applications in the pool.">getActive</a>()<span class="keyword"> const </span>{
688
+ <a name="l00671"></a>00671 <span class="keywordflow">return</span> active;
689
+ <a name="l00672"></a>00672 }
690
+ <a name="l00673"></a>00673
691
+ <a name="l00674"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#cdbfe2b9ffacdab4438c879c2411bf02">00674</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#cdbfe2b9ffacdab4438c879c2411bf02" title="Get the number of active applications in the pool.">getCount</a>()<span class="keyword"> const </span>{
692
+ <a name="l00675"></a>00675 <span class="keywordflow">return</span> count;
693
+ <a name="l00676"></a>00676 }
694
+ <a name="l00677"></a>00677
695
+ <a name="l00678"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#3bafcda8d880f70561ad8a9da16e26ef">00678</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#3bafcda8d880f70561ad8a9da16e26ef" title="Set a hard limit on the number of application instances that a single application...">setMaxPerApp</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxPerApp) {
696
+ <a name="l00679"></a>00679 mutex::scoped_lock l(lock);
697
+ <a name="l00680"></a>00680 this-&gt;maxPerApp = maxPerApp;
698
+ <a name="l00681"></a>00681 activeOrMaxChanged.notify_all();
699
+ <a name="l00682"></a>00682 }
700
+ <a name="l00683"></a>00683
701
+ <a name="l00684"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#e9c699b56f3a755ab10269c7fe585c2d">00684</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#e9c699b56f3a755ab10269c7fe585c2d" title="Sets whether to use a global queue instead of a per-backend process queue.">setUseGlobalQueue</a>(<span class="keywordtype">bool</span> value) {
702
+ <a name="l00685"></a>00685 this-&gt;useGlobalQueue = value;
703
+ <a name="l00686"></a>00686 }
704
+ <a name="l00687"></a>00687
705
+ <a name="l00688"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#6955152d237920988d20297d2fff5660">00688</a> <span class="keyword">virtual</span> pid_t <a class="code" href="classPassenger_1_1StandardApplicationPool.html#6955152d237920988d20297d2fff5660" title="Get the process ID of the spawn server that is used.">getSpawnServerPid</a>()<span class="keyword"> const </span>{
706
+ <a name="l00689"></a>00689 <span class="keywordflow">return</span> spawnManager.<a class="code" href="classPassenger_1_1SpawnManager.html#1f77e2e7e6cb464028c13a29f983ad8e" title="Get the Process ID of the spawn server.">getServerPid</a>();
707
+ <a name="l00690"></a>00690 }
708
+ <a name="l00691"></a>00691 <span class="comment"></span>
709
+ <a name="l00692"></a>00692 <span class="comment"> /**</span>
710
+ <a name="l00693"></a>00693 <span class="comment"> * Returns a textual description of the internal state of</span>
711
+ <a name="l00694"></a>00694 <span class="comment"> * the application pool.</span>
712
+ <a name="l00695"></a>00695 <span class="comment"> */</span>
713
+ <a name="l00696"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#22b4149ca8256c3042fc342e681b0383">00696</a> <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(<span class="keywordtype">bool</span> lockMutex = <span class="keyword">true</span>)<span class="keyword"> const </span>{
714
+ <a name="l00697"></a>00697 <span class="keywordflow">if</span> (lockMutex) {
715
+ <a name="l00698"></a>00698 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(boost::adopt_lock);
716
+ <a name="l00699"></a>00699 } <span class="keywordflow">else</span> {
717
+ <a name="l00700"></a>00700 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#gf6fab368d70c18fdf16bf5a24f630407" title="Convert anything to a string.">toString</a>(boost::defer_lock);
718
+ <a name="l00701"></a>00701 }
719
+ <a name="l00702"></a>00702 }
720
+ <a name="l00703"></a>00703 };
721
+ <a name="l00704"></a>00704
722
+ <a name="l00705"></a>00705 } <span class="comment">// namespace Passenger</span>
723
+ <a name="l00706"></a>00706
724
+ <a name="l00707"></a>00707 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_STANDARD_APPLICATION_POOL_H_ */</span>
725
+ <a name="l00708"></a>00708
727
726
  </pre></div></div>
728
- <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 1 14:27:22 2008 for Passenger by&nbsp;
727
+ <hr size="1"><address style="text-align: right;"><small>Generated on Fri Dec 5 13:53:01 2008 for Passenger by&nbsp;
729
728
  <a href="http://www.doxygen.org/index.html">
730
729
  <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
731
730
  </body>