本文整理汇总了C++中Oam::processInitComplete方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::processInitComplete方法的具体用法?C++ Oam::processInitComplete怎么用?C++ Oam::processInitComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oam
的用法示例。
在下文中一共展示了Oam::processInitComplete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// get and set locale language
string systemLang = "C";
systemLang = funcexp::utf8::idb_setlocale();
setupCwd();
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER
// In windows, initializing the wrapper (A dll) does not set the static variables
// in the main program
idbdatafile::IDBPolicy::configIDBPolicy();
#endif
ResourceManager rm;
Dec = DistributedEngineComm::instance(rm);
#ifndef _MSC_VER
/* set up some signal handlers */
struct sigaction ign;
memset(&ign, 0, sizeof(ign));
ign.sa_handler = added_a_pm;
sigaction(SIGHUP, &ign, 0);
ign.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &ign, 0);
#endif
ddlprocessor::DDLProcessor ddlprocessor(5, 10);
{
Oam oam;
try
{
oam.processInitComplete("DDLProc", ACTIVE);
}
catch (...)
{
}
}
try
{
ddlprocessor.process();
}
catch (std::exception& ex)
{
cerr << ex.what() << endl;
Message::Args args;
Message message(8);
args.add("DDLProc failed on: ");
args.add(ex.what());
message.format( args );
}
catch (...)
{
cerr << "Caught unknown exception!" << endl;
Message::Args args;
Message message(8);
args.add("DDLProc failed on: ");
args.add("receiving DDLPackage");
message.format( args );
}
return 0;
}
示例2: main
int main(int argc, char** argv)
{
// get and set locale language
string systemLang = "C";
systemLang = funcexp::utf8::idb_setlocale();
printf ("Locale is : %s\n", systemLang.c_str() );
//set BUSY_INIT state
{
// Is there a reason to have a seperate Oam instance for this?
Oam oam;
try
{
oam.processInitComplete("WriteEngineServer", oam::BUSY_INIT);
}
catch (...)
{
}
}
//BUG 2991
setlocale(LC_NUMERIC, "C");
#ifndef _MSC_VER
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = added_a_pm;
sigaction(SIGHUP, &sa, 0);
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, 0);
#endif
// Init WriteEngine Wrapper (including Config Calpont.xml cache)
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_WE_SRV );
#ifdef _MSC_VER
// In windows, initializing the wrapper (A dll) does not set the static variables
// in the main program
idbdatafile::IDBPolicy::configIDBPolicy();
#endif
Config weConfig;
int rc;
rc = setupResources();
ostringstream serverParms;
serverParms << "pm" << weConfig.getLocalModuleID() << "_WriteEngineServer";
// Create MessageQueueServer, with one retry in case the call to bind the
// known port fails with "Address already in use".
boost::scoped_ptr<MessageQueueServer> mqs;
bool tellUser = true;
for (;;)
{
try {
mqs.reset(new MessageQueueServer(serverParms.str()));
break;
}
// @bug4393 Error Handling for MessageQueueServer constructor exception
catch (runtime_error& re) {
string what = re.what();
if (what.find("Address already in use") != string::npos)
{
if (tellUser)
{
cerr << "Address already in use, retrying..." << endl;
tellUser = false;
}
sleep(5);
}
else
{
Oam oam;
try // Get out of BUSYINIT state; else OAM will not retry
{
oam.processInitComplete("WriteEngineServer");
}
catch (...)
{
}
// If/when a common logging class or function is added to the
// WriteEngineServer, we should use that. In the mean time,
// I will log this errmsg with inline calls to the logging.
logging::Message::Args args;
logging::Message message;
string errMsg("WriteEngineServer failed to initiate: ");
errMsg += what;
args.add( errMsg );
message.format(args);
logging::LoggingID lid(SUBSYSTEM_ID_WE_SRV);
logging::MessageLog ml(lid);
ml.logCriticalMessage( message );
return 2;
}
}
}
IOSocket ios;
size_t mt = 20;
size_t qs = mt * 100;
//.........这里部分代码省略.........
示例3: 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);
//.........这里部分代码省略.........