本文整理汇总了C++中Oam::processInitFailure方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::processInitFailure方法的具体用法?C++ Oam::processInitFailure怎么用?C++ Oam::processInitFailure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oam
的用法示例。
在下文中一共展示了Oam::processInitFailure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// get and set locale language
string systemLang = "C";
BRM::DBRM dbrm;
Oam oam;
//BUG 5362
systemLang = funcexp::utf8::idb_setlocale();
Config* cf = Config::makeConfig();
setupCwd();
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DMLPROC );
#ifdef _MSC_VER
// In windows, initializing the wrapper (A dll) does not set the static variables
// in the main program
idbdatafile::IDBPolicy::configIDBPolicy();
#endif
try
{
// At first we set to BUSY_INIT
oam.processInitComplete("DMLProc", oam::BUSY_INIT);
}
catch (...)
{
}
//@Bug 1627
try
{
rollbackAll(&dbrm); // Rollback any
}
catch ( std::exception &e )
{
//@Bug 2299 Set DMLProc process to fail and log a message
try
{
oam.processInitFailure();
}
catch (...)
{
}
logging::Message::Args args;
logging::Message message(2);
args.add("DMLProc failed to start due to :");
args.add(e.what());
message.format( args );
logging::LoggingID lid(20);
logging::MessageLog ml(lid);
ml.logCriticalMessage( message );
cerr << "DMLProc failed to start due to : " << e.what() << endl;
return 1;
}
int temp;
int serverThreads = 10;
int serverQueueSize = 50;
const string DMLProc("DMLProc");
temp = toInt(cf->getConfig(DMLProc, "ServerThreads"));
if (temp > 0)
serverThreads = temp;
temp = toInt(cf->getConfig(DMLProc, "ServerQueueSize"));
if (temp > 0)
serverQueueSize = temp;
bool rootUser = true;
#ifndef _MSC_VER
//check if root-user
int user;
user = getuid();
if (user != 0)
rootUser = false;
#endif
//read and cleanup port before trying to use
try {
string port = cf->getConfig(DMLProc, "Port");
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
if ( !rootUser)
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
(void)::system(cmd.c_str());
}
catch(...)
{
}
DMLServer dmlserver(serverThreads, serverQueueSize,&dbrm);
//set ACTIVE state
try
{
oam.processInitComplete("DMLProc", ACTIVE);
//.........这里部分代码省略.........