本文整理汇总了C++中ObjectPrx::ice_oneway方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPrx::ice_oneway方法的具体用法?C++ ObjectPrx::ice_oneway怎么用?C++ ObjectPrx::ice_oneway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPrx
的用法示例。
在下文中一共展示了ObjectPrx::ice_oneway方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
virtual
void run()
{
CommunicatorPtr communicator = initialize(initData);
ObjectPrx routerBase = communicator->stringToProxy(
"Glacier2/router:" + TestHelper::getTestEndpoint(communicator->getProperties(), 50));
_router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator->setDefaultRouter(_router);
ostringstream os;
os << "userid-" << _id;
Glacier2::SessionPrx session = _router->createSession(os.str(), "abc123");
communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", _router);
adapter->activate();
string category = _router->getCategoryForClient();
_callbackReceiver = new CallbackReceiverI;
Identity ident;
ident.name = "callbackReceiver";
ident.category = category;
CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
ObjectPrx base = communicator->stringToProxy(
"c1/callback:" + TestHelper::getTestEndpoint(communicator->getProperties()));
base = base->ice_oneway();
CallbackPrx callback = CallbackPrx::uncheckedCast(base);
{
Lock sync(*this);
_initialized = true;
notifyAll();
}
{
Lock sync(*this);
while(!_notified)
{
wait();
}
}
//
// Stress the router until the connection is closed.
//
stress(callback, receiver);
communicator->destroy();
}
示例2: run
virtual
void run()
{
CommunicatorPtr communicator = initialize(initData);
ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347 -t 10000");
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator->setDefaultRouter(router);
ostringstream os;
os << "userid-" << _id;
Glacier2::SessionPrx session = router->createSession(os.str(), "abc123");
communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
adapter->activate();
string category = router->getCategoryForClient();
{
Lock sync(*this);
_callbackReceiver = new CallbackReceiverI;
notify();
}
Identity ident;
ident.name = "callbackReceiver";
ident.category = category;
CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
base = base->ice_oneway();
CallbackPrx callback = CallbackPrx::uncheckedCast(base);
//
// Block the CallbackReceiver in wait() to prevent the client from
// processing other incoming calls and wait to receive the callback.
//
callback->initiateWaitCallback(receiver);
test(_callbackReceiver->waitCallbackOK());
//
// Notify the main thread that the callback was received.
//
{
Lock sync(*this);
_callback = true;
notify();
}
//
// Callback the client with a large payload. This should cause
// the Glacier2 request queue thread to block trying to send the
// callback to the client because the client is currently blocked
// in CallbackReceiverI::waitCallback() and can't process more
// requests.
//
callback->initiateCallbackWithPayload(receiver);
test(_callbackReceiver->callbackWithPayloadOK());
try
{
router->destroySession();
test(false);
}
catch(const Ice::ConnectionLostException&)
{
}
catch(const Ice::LocalException&)
{
test(false);
}
communicator->destroy();
}
示例3: if
int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
bool batch = false;
int idx = 1;
while(idx < argc)
{
if(strcmp(argv[idx], "-b") == 0)
{
batch = true;
for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
}
PropertiesPtr properties = communicator->getProperties();
const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
return EXIT_FAILURE;
}
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
EventIPtr eventFed1 = new EventI(communicator);
//
// Activate the servants.
//
ObjectPrx obj = adapter->addWithUUID(eventFed1);
IceStorm::QoS qos;
if(batch)
{
obj = obj->ice_batchOneway();
}
else
{
obj = obj->ice_oneway();
}
TopicPrx fed1;
try
{
fed1 = manager->retrieve("fed1");
}
catch(const IceStorm::NoSuchTopic& e)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
}
fed1->subscribeAndGetPublisher(qos, obj);
adapter->activate();
communicator->waitForShutdown();
fed1->unsubscribe(obj);
return EXIT_SUCCESS;
}
示例4: if
void
Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amdCB,
const std::pair<const Byte*, const Byte*>& inParams, const Current& current)
{
//
// Set the correct facet on the proxy.
//
if(!current.facet.empty())
{
proxy = proxy->ice_facet(current.facet);
}
//
// Modify the proxy according to the request id. This can
// be overridden by the _fwd context.
//
if(current.requestId == 0)
{
if(_alwaysBatch && _requestQueue)
{
proxy = proxy->ice_batchOneway();
}
else
{
proxy = proxy->ice_oneway();
}
}
else if(current.requestId > 0)
{
proxy = proxy->ice_twoway();
}
//
// Modify the proxy according to the _fwd context field.
//
Context::const_iterator p = current.ctx.find("_fwd");
if(p != current.ctx.end())
{
for(unsigned int i = 0; i < p->second.length(); ++i)
{
char option = p->second[i];
switch(option)
{
case 't':
{
proxy = proxy->ice_twoway();
break;
}
case 'o':
{
if(_alwaysBatch && _requestQueue)
{
proxy = proxy->ice_batchOneway();
}
else
{
proxy = proxy->ice_oneway();
}
break;
}
case 'd':
{
if(_alwaysBatch && _requestQueue)
{
proxy = proxy->ice_batchDatagram();
}
else
{
proxy = proxy->ice_datagram();
}
break;
}
case 'O':
{
if(_requestQueue)
{
proxy = proxy->ice_batchOneway();
}
else
{
proxy = proxy->ice_oneway();
}
break;
}
case 'D':
{
if(_requestQueue)
{
proxy = proxy->ice_batchDatagram();
}
else
{
proxy = proxy->ice_datagram();
}
break;
}
//.........这里部分代码省略.........