本文整理汇总了C++中AdminPrx::getServerInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ AdminPrx::getServerInfo方法的具体用法?C++ AdminPrx::getServerInfo怎么用?C++ AdminPrx::getServerInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminPrx
的用法示例。
在下文中一共展示了AdminPrx::getServerInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
void
updateServiceRuntimeProperties(const AdminPrx& admin, const ServiceDescriptorPtr& desc)
{
ServerInfo info = admin->getServerInfo("IceBox");
test(info.descriptor);
IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(info.descriptor);
for(ServiceInstanceDescriptorSeq::const_iterator p = iceBox->services.begin(); p != iceBox->services.end(); ++p)
{
if(p->descriptor->name == desc->name)
{
p->descriptor->propertySet.properties = desc->propertySet.properties;
}
}
ApplicationUpdateDescriptor update;
update.name = "TestApp";
NodeUpdateDescriptor node;
node.name = "localnode";
node.servers.push_back(info.descriptor);
update.nodes.push_back(node);
try
{
admin->updateApplicationWithoutRestart(update);
}
catch(const DeploymentException& ex)
{
cerr << ex.reason << endl;
test(false);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
}
示例2: catch
void
removeServer(const AdminPrx& admin, const string& id)
{
try
{
admin->enableServer(id, false); // Makes sure the server isn't activated on-demand after the stop.
admin->stopServer(id);
}
catch(const ServerStopException&)
{
}
catch(const NodeUnreachableException&)
{
}
catch(const Ice::UserException& ex)
{
cerr << ex << endl;
test(false);
}
ServerInfo info = admin->getServerInfo(id);
NodeUpdateDescriptor nodeUpdate;
nodeUpdate.name = info.node;
nodeUpdate.removeServers.push_back(id);
ApplicationUpdateDescriptor update;
update.name = info.application;
update.nodes.push_back(nodeUpdate);
try
{
admin->updateApplication(update);
}
catch(const DeploymentException& ex)
{
cerr << ex.reason << endl;
test(false);
}
}
示例3: test
//.........这里部分代码省略.........
asyncCB33->waitResponse(__FILE__, __LINE__);
test(asyncCB33->hasResponse(dummy) && dummy);
session1->releaseObject(allocatable3);
cout << "ok" << endl;
cout << "testing session destroy... " << flush;
obj = session2->allocateObjectByType("::Test"); // Allocate the object
test(obj && obj->ice_getIdentity().name == "allocatable");
session1->setAllocationTimeout(allocationTimeout);
asyncCB3 = new Callback();
cb3 = IceGrid::newCallback_Session_allocateObjectByType(asyncCB3, &Callback::response, &Callback::exception);
session1->begin_allocateObjectByType("::Test", cb3);
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
test(!asyncCB3->hasResponse(dummy));
session2->destroy();
asyncCB3->waitResponse(__FILE__, __LINE__);
test(asyncCB3->hasResponse(obj));
session1->destroy();
session2 = SessionPrx::uncheckedCast(registry->createSession("Client2", ""));
session2->setAllocationTimeout(0);
session2->allocateObjectById(allocatable);
session2->destroy();
cout << "ok" << endl;
cout << "testing application updates with allocated objects... " << flush;
{
SessionPrx session1 = registry->createSession("Client1", "");
SessionPrx session2 = registry->createSession("Client2", "");
ServerDescriptorPtr objectAllocOriginal = admin->getServerInfo("ObjectAllocation").descriptor;
ServerDescriptorPtr objectAllocUpdate = ServerDescriptorPtr::dynamicCast(objectAllocOriginal->ice_clone());
ServerDescriptorPtr serverAllocOriginal = admin->getServerInfo("ServerAllocation").descriptor;
ServerDescriptorPtr serverAllocUpdate = ServerDescriptorPtr::dynamicCast(serverAllocOriginal->ice_clone());
NodeUpdateDescriptor nodeUpdate;
nodeUpdate.name = "localnode";
nodeUpdate.servers.push_back(objectAllocUpdate);
nodeUpdate.servers.push_back(serverAllocUpdate);
ApplicationUpdateDescriptor appUpdate;
appUpdate.name = "Test";
appUpdate.nodes.push_back(nodeUpdate);
{
session1->allocateObjectById(allocatable3);
Ice::AsyncResultPtr r2 = session2->begin_allocateObjectById(allocatable4);
session1->allocateObjectById(allocatable4);
session1->releaseObject(allocatable4);
test(!r2->isCompleted());
serverAllocUpdate->allocatable = false;
admin->updateApplication(appUpdate);
test(!r2->isCompleted());
session1->releaseObject(allocatable3);
session2->end_allocateObjectById(r2);
session2->releaseObject(allocatable4);
serverAllocUpdate->allocatable = true;
示例4: test
//.........这里部分代码省略.........
update.variables["test.dir"] = properties->getProperty("TestDir");
update.variables["variable"] = "";
instance = ServerInstanceDescriptor();
instance._cpp_template = "ServerTemplate";
instance.parameterValues["name"] = "Server1";
update.nodes[0].serverInstances.push_back(instance);
try
{
admin->updateApplication(update);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing server remove... " << flush;
update = empty;
update.nodes[0].removeServers.push_back("Server2");
try
{
admin->updateApplication(update);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
try
{
admin->getServerInfo("Server2");
test(false);
}
catch(const ServerNotExistException&)
{
}
try
{
admin->updateApplication(update);
}
catch(const DeploymentException& ex)
{
cerr << ex.reason << endl;
test(false);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
test(false);
}
update = empty;
update.removeServerTemplates.push_back("ServerTemplate");
try
{
admin->updateApplication(update);
test(false);
}
catch(const DeploymentException&)
{
// Server without template!
}