本文整理汇总了C++中AdminPrx::getServerPid方法的典型用法代码示例。如果您正苦于以下问题:C++ AdminPrx::getServerPid方法的具体用法?C++ AdminPrx::getServerPid怎么用?C++ AdminPrx::getServerPid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminPrx
的用法示例。
在下文中一共展示了AdminPrx::getServerPid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
void
allTests(const Ice::CommunicatorPtr& communicator)
{
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"));
test(registry);
AdminSessionPrx session = registry->createAdminSession("foo", "bar");
session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways);
AdminPrx admin = session->getAdmin();
test(admin);
Ice::PropertiesPtr properties = communicator->getProperties();
{
ApplicationDescriptor testApp;
testApp.name = "TestApp";
admin->addApplication(testApp);
ApplicationUpdateDescriptor empty;
empty.name = "TestApp";
NodeUpdateDescriptor node;
node.name = "localnode";
empty.nodes.push_back(node);
ApplicationUpdateDescriptor update = empty;
cout << "testing server add... " << flush;
ServerDescriptorPtr server = new ServerDescriptor();
server->id = "Server";
server->exe = properties->getProperty("ServerDir") + "/server";
server->pwd = ".";
server->applicationDistrib = false;
server->allocatable = false;
server->activation = "on-demand";
addProperty(server, "Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
AdapterDescriptor adapter;
adapter.name = "Server";
adapter.id = "ServerAdapter";
adapter.registerProcess = false;
adapter.serverLifetime = true;
addProperty(server, "Server.Endpoints", "default");
ObjectDescriptor object;
object.id = communicator->stringToIdentity("${server}");
object.type = "::Test::TestIntf";
adapter.objects.push_back(object);
server->adapters.push_back(adapter);
update.nodes[0].servers.push_back(server);
admin->updateApplicationWithoutRestart(update);
admin->startServer("Server");
int serverPid = admin->getServerPid("Server");
update.nodes[0].servers[0]->id = "Server2";
update.nodes[0].servers[0]->adapters[0].id = "ServerAdapter2";
update.nodes[0].servers[0]->adapters[0].objects[0].id = communicator->stringToIdentity("test2");
try
{
admin->updateApplicationWithoutRestart(update);
}
catch(const DeploymentException& ex)
{
cerr << ex.reason << endl;
test(false);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
admin->startServer("Server2");
int server2Pid = admin->getServerPid("Server2");
TemplateDescriptor templ;
templ.parameters.push_back("name");
templ.descriptor = new ServerDescriptor();
server = ServerDescriptorPtr::dynamicCast(templ.descriptor);
server->id = "${name}";
server->exe = "${server.dir}/server";
server->pwd = ".";
server->applicationDistrib = false;
server->allocatable = false;
server->activation = "on-demand";
addProperty(server, "Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
adapter = AdapterDescriptor();
adapter.name = "Server";
adapter.id = "${server}";
adapter.registerProcess = false;
adapter.serverLifetime = true;
addProperty(server, "Server.Endpoints", "default");
object = ObjectDescriptor();
object.id = communicator->stringToIdentity("${server}");
object.type = "::Test::TestIntf";
adapter.objects.push_back(object);
server->adapters.push_back(adapter);
update = empty;
update.serverTemplates["ServerTemplate"] = templ;
try
{
//.........这里部分代码省略.........