本文整理汇总了C++中ObjectAdapterPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ObjectAdapterPtr类的具体用法?C++ ObjectAdapterPtr怎么用?C++ ObjectAdapterPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectAdapterPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTestEndpoint
void
TestI::transient(const Current& current)
{
CommunicatorPtr communicator = current.adapter->getCommunicator();
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter",
getTestEndpoint(communicator, 1));
adapter->activate();
adapter->destroy();
}
示例2: communicator
int
CallbackServer::run(int, char**)
{
communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter");
adapter->add(new CallbackI(), communicator()->stringToIdentity("c/callback"));
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
示例3: communicator
int
SessionControlServer::run(int, char**)
{
communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", "tcp -p 12010");
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter");
adapter->add(new SessionManagerI, communicator()->stringToIdentity("SessionManager"));
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
示例4: communicator
int
CallbackServer::run(int, char**)
{
communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter");
adapter->add(new CallbackI(), communicator()->stringToIdentity("c1/callback")); // The test allows "c1" as category.
adapter->add(new CallbackI(), communicator()->stringToIdentity("c2/callback")); // The test allows "c2" as category.
adapter->add(new CallbackI(), communicator()->stringToIdentity("c3/callback")); // The test rejects "c3" as category.
adapter->add(new CallbackI(), communicator()->stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
示例5: ServerLocatorI
ServerLocatorI(BackendPtr backend, ObjectAdapterPtr adapter) :
_backend(backend),
_adapter(adapter)
{
_registryPrx = LocatorRegistryPrx::uncheckedCast(adapter->add(new ServerLocatorRegistry,
Ice::stringToIdentity("registry")));
}
示例6:
Freeze::EvictorIBase::EvictorIBase(const ObjectAdapterPtr& adapter,
const string& envName,
DbEnv* dbEnv,
const string& filename,
const FacetTypeMap& facetTypes,
const ServantInitializerPtr& initializer,
bool createDb) :
_evictorSize(10),
_facetTypes(facetTypes),
_deactivateController(this),
_adapter(adapter),
_communicator(adapter->getCommunicator()),
_initializer(initializer),
_dbEnv(SharedDbEnv::get(_communicator, envName, dbEnv)),
_filename(filename),
_createDb(createDb),
_trace(0),
_txTrace(0),
_pingObject(new PingObject)
{
_encoding = _dbEnv->getEncoding();
_trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Evictor");
_txTrace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Transaction");
_deadlockWarning = (_communicator->getProperties()->getPropertyAsInt("Freeze.Warn.Deadlocks") > 0);
}
示例7: FailureException
void
ServiceI::start(const CommunicatorPtr& communicator,
const ObjectAdapterPtr& topicAdapter,
const ObjectAdapterPtr& publishAdapter,
const string& name,
const Ice::Identity& id,
const string& /*dbEnv*/)
{
//
// For IceGrid we don't validate the properties as all sorts of
// non-IceStorm properties are included in the prefix.
//
//validateProperties(name, communicator->getProperties(), communicator->getLogger());
// This is for IceGrid only and as such we use a transient
// implementation of IceStorm.
string instanceName = communicator->getProperties()->getPropertyWithDefault(name + ".InstanceName", "IceStorm");
_instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter, 0);
try
{
TransientTopicManagerImplPtr manager = new TransientTopicManagerImpl(_instance);
_managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(manager, id));
}
catch(const Ice::Exception& ex)
{
_instance = 0;
LoggerOutputBase s;
s << "exception while starting IceStorm service " << name << ":\n";
s << ex;
throw IceBox::FailureException(__FILE__, __LINE__, s.str());
}
}
示例8: 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();
}
示例9: initialize
void
Client::run(int argc, char** argv)
{
Ice::CommunicatorHolder communicator = initialize(argc, argv);
ObjectPrx base = communicator->stringToProxy("Test.IceStorm/TopicManager");
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
ostringstream os;
os << argv[0] << ": `Test.IceStorm/TopicManager' is not running";
throw invalid_argument(os.str());
}
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:udp");
TopicPrx topic = manager->create("single");
//
// Create subscribers with different QoS.
//
SingleIPtr sub = new SingleI;
topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(sub));
adapter->activate();
// Ensure that getPublisher & getNonReplicatedPublisher work
// correctly.
Ice::ObjectPrx p1 = topic->getPublisher();
Ice::ObjectPrx p2 = topic->getNonReplicatedPublisher();
test(p1->ice_getAdapterId() == "PublishReplicaGroup");
test(p2->ice_getAdapterId() == "Test.IceStorm1.Publish" ||
p2->ice_getAdapterId() == "Test.IceStorm2.Publish" ||
p2->ice_getAdapterId() == "Test.IceStorm3.Publish");
//
// Get a publisher object, create a twoway proxy and then cast to
// a Single object.
//
SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
for(int i = 0; i < 1000; ++i)
{
single->event(i);
}
sub->waitForEvents();
}
示例10: communicator
int
BackendServer::run(int argc, char* argv[])
{
string endpoints =
communicator()->getProperties()->getPropertyWithDefault("BackendAdapter.Endpoints",
"tcp -p 12010 -t 20000:ssl -p 12011 -t 20000");
communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", endpoints);
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BackendAdapter");
BackendPtr backend = new BackendI;
Ice::LocatorPtr locator = new ServerLocatorI(backend, adapter);
adapter->add(locator, communicator()->stringToIdentity("locator"));
adapter->addServantLocator(new ServantLocatorI(backend), "");
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
示例11: ServerLocatorI
ServerLocatorI(const BackendPtr& backend, const ObjectAdapterPtr& adapter) :
_backend(backend),
_adapter(adapter),
_registryPrx(
LocatorRegistryPrx::uncheckedCast(
adapter->add(new ServerLocatorRegistry, _adapter->getCommunicator()->stringToIdentity("registry"))))
{
}
示例12: run
int run(int argc, char* argv[]) {
Example::CallbackIPtr servant = new Example::CallbackI(communicator());
ObjectAdapterPtr adapter =
communicator()->createObjectAdapter("CallbackAdapter");
ObjectPrx proxy = adapter->add(
servant, communicator()->stringToIdentity("callback"));
cout << communicator()->proxyToString(proxy) << endl;
adapter->activate();
servant->start();
shutdownOnInterrupt();
communicator()->waitForShutdown();
servant->destroy();
return 0;
}
示例13: communicator
int
SessionControlServer::run(int, char*[])
{
//
// The server requires 3 separate server endpoints. One for the test
// controller that will coordinate the tests and the required
// configurations across the client and the router, an adapter for
// the session manager for the router to communicate with and
// finally, an adapter for the dummy backend server that the client
// will ultimately attempt to make calls on. The backend uses a
// servant locator that responds to each lookup with the same
// servant, allowing us to use any reference as long as the client
// expects to use a proxy for the correct type of object.
//
communicator()->getProperties()->setProperty("TestControllerAdapter.Endpoints",
getTestEndpoint(communicator(), 2, "tcp"));
ObjectAdapterPtr controllerAdapter = communicator()->createObjectAdapter("TestControllerAdapter");
TestControllerIPtr controller = new TestControllerI(getTestEndpoint(communicator(), 1));
controllerAdapter->add(controller, Ice::stringToIdentity("testController"));
controllerAdapter->activate();
communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter");
adapter->add(new SessionManagerI(controller), Ice::stringToIdentity("SessionManager"));
adapter->activate();
BackendPtr backend = new BackendI;
communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", getTestEndpoint(communicator(), 1));
ObjectAdapterPtr backendAdapter = communicator()->createObjectAdapter("BackendAdapter");
backendAdapter->addServantLocator(new ServantLocatorI(backend), "");
backendAdapter->activate();
Ice::LocatorPtr locator = new ServerLocatorI(backend, backendAdapter);
backendAdapter->add(locator, Ice::stringToIdentity("locator"));
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
示例14: sync
void
IceInternal::ObjectAdapterFactory::removeObjectAdapter(const ObjectAdapterPtr& adapter)
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
if(!_instance)
{
return;
}
for(list<ObjectAdapterIPtr>::iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
if(*p == adapter)
{
_adapters.erase(p);
break;
}
}
_adapterNamesInUse.erase(adapter->getName());
}
示例15: assert
//.........这里部分代码省略.........
//
// Ensure that nothing is running on this port. This is also
// useful to ensure that we don't run twice the same instance of
// the service too (which would cause the database environment of
// the already running instance to be "corrupted".)
//
try
{
string endpoints = properties->getProperty("IceGrid.Registry.Client.Endpoints");
string strPrx = _instanceName + "/Locator:" + endpoints;
_communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping();
Error out(_communicator->getLogger());
out << "an IceGrid registry is already running and listening on the client endpoints `" << endpoints << "'";
return false;
}
catch(const Ice::LocalException&)
{
}
properties->setProperty("Freeze.DbEnv.Registry.DbHome", dbPath);
properties->setProperty("Freeze.DbEnv.Registry.DbPrivate", "0");
//
// Create the reaper thread.
//
_reaper = new ReapThread();
_reaper->start();
//
// Create the internal registry object adapter.
//
ObjectAdapterPtr registryAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Internal");
registryAdapter->activate();
//
// Create the internal IceStorm service.
//
Identity registryTopicManagerId;
registryTopicManagerId.category = _instanceName;
registryTopicManagerId.name = "RegistryTopicManager";
_iceStorm = IceStorm::Service::create(_communicator,
registryAdapter,
registryAdapter,
"IceGrid.Registry",
registryTopicManagerId,
"Registry");
const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager();
//
// Create the registry database.
//
_database = new Database(registryAdapter, topicManager, _instanceName, _traceLevels, getInfo());
_wellKnownObjects = new WellKnownObjectsManager(_database);
//
// Get the saved replica/node proxies and remove them from the
// database.
//
Ice::ObjectProxySeq proxies;
Ice::ObjectProxySeq::const_iterator p;
NodePrxSeq nodes;
proxies = _database->getInternalObjectsByType(Node::ice_staticId());
for(p = proxies.begin(); p != proxies.end(); ++p)