0
@@ -278,6 +278,21 @@ private:
0
+ void handleConnectException(const exception &e, const ApplicationPtr &app,
0
+ ApplicationList &appList) {
0
+ string message("Cannot connect to an existing application instance for '");
0
+ message.append(app->getAppRoot());
0
+ message.append("': ");
0
+ message.append(e.what());
0
+ if (appList.empty()) {
0
+ apps.erase(app->getAppRoot());
0
+ throw IOException(message);
0
* Create a new StandardApplicationPool object.
0
@@ -339,6 +354,7 @@ public:
0
+ ApplicationList *appList;
0
mutex::scoped_lock l(lock);
0
if (needsRestart(appRoot)) {
0
@@ -348,23 +364,23 @@ public:
0
ApplicationMap::iterator it(apps.find(appRoot));
0
if (it != apps.end()) {
0
-
ApplicationList &appList(*it->second);
0
+
appList = it->second.get();
0
- if (appList.front()->getSessions() == 0) {
0
- app = appList.front();
0
- appList.push_back(app);
0
+ if (appList->front()->getSessions() == 0) {
0
+ app = appList->front();
0
+ appList->push_back(app);
0
} else if (count < max) {
0
app = spawnManager.spawn(appRoot, user, group);
0
- appList
.push_back(app);
0
+ appList
->push_back(app);
0
countOrMaxChanged.notify_all();
0
- app = appList.front();
0
- appList.push_back(app);
0
+ app = appList->front();
0
+ appList->push_back(app);
0
@@ -372,9 +388,9 @@ public:
0
countOrMaxChanged.wait(l);
0
app = spawnManager.spawn(appRoot, user, group);
0
-
ApplicationListPtr appList(new ApplicationList());
0
+
appList = new ApplicationList();
0
appList->push_back(app);
0
- apps[appRoot] =
appList;
0
+ apps[appRoot] =
ptr(appList);
0
countOrMaxChanged.notify_all();
0
@@ -397,17 +413,13 @@ public:
0
return app->connect(SessionCloseCallback(data, app));
0
} catch (const IOException &e) {
0
- string message("Cannot connect to an existing application instance for '");
0
- message.append(appRoot);
0
- message.append("': ");
0
- message.append(e.what());
0
- throw IOException(message);
0
+ handleConnectException(e, app, *appList);
0
+ // Never reached; shut up compiler warning
0
+ return Application::SessionPtr();
0
} catch (const SystemException &e) {
0
- string message("Cannot connect to an existing application instance for '");
0
- message.append(appRoot);
0
- message.append("': ");
0
- message.append(e.what());
0
- throw IOException(message);
0
+ handleConnectException(e, app, *appList);
0
+ // Never reached; shut up compiler warning
0
+ return Application::SessionPtr();
Comments
No one has commented yet.