本文整理汇总了C++中PoolPtr::setMax方法的典型用法代码示例。如果您正苦于以下问题:C++ PoolPtr::setMax方法的具体用法?C++ PoolPtr::setMax怎么用?C++ PoolPtr::setMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PoolPtr
的用法示例。
在下文中一共展示了PoolPtr::setMax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RuntimeException
Server(FileDescriptor feedbackFd, const AgentOptions &_options)
: options(_options),
requestLoop(true),
serverInstanceDir(_options.serverInstanceDir, false),
resourceLocator(options.passengerRoot)
{
TRACE_POINT();
this->feedbackFd = feedbackFd;
UPDATE_TRACE_POINT();
generation = serverInstanceDir.getGeneration(options.generationNumber);
startListening();
accountsDatabase = boost::make_shared<AccountsDatabase>();
accountsDatabase->add("_passenger-status", options.adminToolStatusPassword, false,
Account::INSPECT_BASIC_INFO | Account::INSPECT_SENSITIVE_INFO |
Account::INSPECT_BACKTRACES | Account::INSPECT_REQUESTS);
accountsDatabase->add("_web_server", options.exitPassword, false, Account::EXIT);
messageServer = boost::make_shared<MessageServer>(
parseUnixSocketAddress(options.adminSocketAddress), accountsDatabase);
createFile(generation->getPath() + "/helper_agent.pid",
toString(getpid()), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (geteuid() == 0 && !options.userSwitching) {
lowerPrivilege(options.defaultUser, options.defaultGroup);
}
UPDATE_TRACE_POINT();
randomGenerator = boost::make_shared<RandomGenerator>();
// Check whether /dev/urandom is actually random.
// https://code.google.com/p/phusion-passenger/issues/detail?id=516
if (randomGenerator->generateByteString(16) == randomGenerator->generateByteString(16)) {
throw RuntimeException("Your random number device, /dev/urandom, appears to be broken. "
"It doesn't seem to be returning random data. Please fix this.");
}
UPDATE_TRACE_POINT();
loggerFactory = boost::make_shared<UnionStation::LoggerFactory>(options.loggingAgentAddress,
"logging", options.loggingAgentPassword);
spawnerFactory = boost::make_shared<SpawnerFactory>(poolLoop.safe,
resourceLocator, generation, boost::make_shared<SpawnerConfig>(randomGenerator));
pool = boost::make_shared<Pool>(poolLoop.safe.get(), spawnerFactory, loggerFactory,
randomGenerator);
pool->initialize();
pool->setMax(options.maxPoolSize);
//pool->setMaxPerApp(maxInstancesPerApp);
pool->setMaxIdleTime(options.poolIdleTime * 1000000);
requestHandler = boost::make_shared<RequestHandler>(requestLoop.safe,
requestSocket, pool, options);
messageServer->addHandler(boost::make_shared<RemoteController>(requestHandler, pool));
messageServer->addHandler(ptr(new ExitHandler(exitEvent)));
sigquitWatcher.set(requestLoop.loop);
sigquitWatcher.set(SIGQUIT);
sigquitWatcher.set<Server, &Server::onSigquit>(this);
sigquitWatcher.start();
UPDATE_TRACE_POINT();
writeArrayMessage(feedbackFd,
"initialized",
getRequestSocketFilename().c_str(),
messageServer->getSocketFilename().c_str(),
NULL);
boost::function<void ()> func = boost::bind(prestartWebApps,
resourceLocator,
options.defaultRubyCommand,
options.prestartUrls
);
prestarterThread = ptr(new oxt::thread(
boost::bind(runAndPrintExceptions, func, true)
));
}
示例2: options
Server(FileDescriptor feedbackFd, const AgentOptions &_options)
: options(_options),
requestLoop(true),
serverInstanceDir(options.webServerPid, options.tempDir, false),
resourceLocator(options.passengerRoot)
{
TRACE_POINT();
this->feedbackFd = feedbackFd;
UPDATE_TRACE_POINT();
generation = serverInstanceDir.getGeneration(options.generationNumber);
startListening();
accountsDatabase = AccountsDatabase::createDefault(generation,
options.userSwitching, options.defaultUser, options.defaultGroup);
accountsDatabase->add("_web_server", options.messageSocketPassword, false, Account::EXIT);
messageServer = ptr(new MessageServer(generation->getPath() + "/socket", accountsDatabase));
createFile(generation->getPath() + "/helper_agent.pid",
toString(getpid()), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (geteuid() == 0 && !options.userSwitching) {
lowerPrivilege(options.defaultUser, options.defaultGroup);
}
UPDATE_TRACE_POINT();
loggerFactory = make_shared<UnionStation::LoggerFactory>(options.loggingAgentAddress,
"logging", options.loggingAgentPassword);
randomGenerator = make_shared<RandomGenerator>();
spawnerFactory = make_shared<SpawnerFactory>(poolLoop.safe,
resourceLocator, generation, randomGenerator);
pool = make_shared<Pool>(poolLoop.safe.get(), spawnerFactory, loggerFactory,
randomGenerator);
pool->setMax(options.maxPoolSize);
//pool->setMaxPerApp(maxInstancesPerApp);
pool->setMaxIdleTime(options.poolIdleTime * 1000000);
messageServer->addHandler(make_shared<RemoteController>(pool));
messageServer->addHandler(make_shared<BacktracesServer>());
messageServer->addHandler(ptr(new ExitHandler(exitEvent)));
requestHandler = make_shared<RequestHandler>(requestLoop.safe,
requestSocket, pool, options);
sigquitWatcher.set(requestLoop.loop);
sigquitWatcher.set(SIGQUIT);
sigquitWatcher.set<Server, &Server::onSigquit>(this);
sigquitWatcher.start();
UPDATE_TRACE_POINT();
writeArrayMessage(feedbackFd,
"initialized",
getRequestSocketFilename().c_str(),
messageServer->getSocketFilename().c_str(),
NULL);
function<void ()> func = boost::bind(prestartWebApps,
resourceLocator,
options.prestartUrls
);
prestarterThread = ptr(new oxt::thread(
boost::bind(runAndPrintExceptions, func, true)
));
}