当前位置: 首页>>代码示例>>C++>>正文


C++ CommunicatorPtr::getObserver方法代码示例

本文整理汇总了C++中ice::CommunicatorPtr::getObserver方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr::getObserver方法的具体用法?C++ CommunicatorPtr::getObserver怎么用?C++ CommunicatorPtr::getObserver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ice::CommunicatorPtr的用法示例。


在下文中一共展示了CommunicatorPtr::getObserver方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RouterObserverI

Glacier2::Instance::Instance(const Ice::CommunicatorPtr& communicator, const Ice::ObjectAdapterPtr& clientAdapter, 
                             const Ice::ObjectAdapterPtr& serverAdapter) :
    _communicator(communicator),
    _properties(communicator->getProperties()),
    _logger(communicator->getLogger()),
    _clientAdapter(clientAdapter),
    _serverAdapter(serverAdapter)
{
    if(_properties->getPropertyAsIntWithDefault(serverBuffered, 1) > 0)
    {
        IceUtil::Time sleepTime = IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(serverSleepTime));
        const_cast<RequestQueueThreadPtr&>(_serverRequestQueueThread) = new RequestQueueThread(sleepTime);
        try
        {
            _serverRequestQueueThread->start();
        }
        catch(const IceUtil::Exception&)
        {
            _serverRequestQueueThread->destroy();
            throw;
        }
    }

    if(_properties->getPropertyAsIntWithDefault(clientBuffered, 1) > 0)
    {
        IceUtil::Time sleepTime = IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(clientSleepTime));
        const_cast<RequestQueueThreadPtr&>(_clientRequestQueueThread) = new RequestQueueThread(sleepTime);
        try
        {
            _clientRequestQueueThread->start();
        }
        catch(const IceUtil::Exception&)
        {
            _clientRequestQueueThread->destroy();
            throw;
        }
    }

    const_cast<ProxyVerifierPtr&>(_proxyVerifier) = new ProxyVerifier(communicator);

    //
    // If an Ice metrics observer is setup on the communicator, also
    // enable metrics for IceStorm.
    //
    IceInternal::CommunicatorObserverIPtr o = 
        IceInternal::CommunicatorObserverIPtr::dynamicCast(communicator->getObserver());
    if(o)
    {
        const_cast<Glacier2::Instrumentation::RouterObserverPtr&>(_observer) = 
            new RouterObserverI(o->getFacet(), 
                                _properties->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2"));
    }
}
开发者ID:Jonavin,项目名称:ice,代码行数:53,代码来源:Instance.cpp

示例2: TraceLevels

Instance::Instance(
    const string& instanceName,
    const string& name,
    const Ice::CommunicatorPtr& communicator,
    const Ice::ObjectAdapterPtr& publishAdapter,
    const Ice::ObjectAdapterPtr& topicAdapter,
    const Ice::ObjectAdapterPtr& nodeAdapter,
    const NodePrx& nodeProxy) :
    _instanceName(instanceName),
    _serviceName(name),
    _communicator(communicator),
    _publishAdapter(publishAdapter),
    _topicAdapter(topicAdapter),
    _nodeAdapter(nodeAdapter),
    _nodeProxy(nodeProxy),
    _traceLevels(new TraceLevels(name, communicator->getProperties(), communicator->getLogger())),
    _discardInterval(IceUtil::Time::seconds(communicator->getProperties()->getPropertyAsIntWithDefault(
            name + ".Discard.Interval", 60))), // default one minute.
    _flushInterval(IceUtil::Time::milliSeconds(communicator->getProperties()->getPropertyAsIntWithDefault(
                       name + ".Flush.Timeout", 1000))), // default one second.
    // default one minute.
    _sendTimeout(communicator->getProperties()->getPropertyAsIntWithDefault(name + ".Send.Timeout", 60 * 1000)),
    _topicReaper(new TopicReaper())
{
    try
    {
        __setNoDelete(true);

        Ice::PropertiesPtr properties = communicator->getProperties();
        if(properties->getProperty(name + ".TopicManager.AdapterId").empty())
        {
            string p = properties->getProperty(name + ".ReplicatedTopicManagerEndpoints");
            if(!p.empty())
            {
                const_cast<Ice::ObjectPrx&>(_topicReplicaProxy) = communicator->stringToProxy("dummy:" + p);
            }
            p = properties->getProperty(name + ".ReplicatedPublishEndpoints");
            if(!p.empty())
            {
                const_cast<Ice::ObjectPrx&>(_publisherReplicaProxy) = communicator->stringToProxy("dummy:" + p);
            }
        }
        _observers = new Observers(this);
        _batchFlusher = new IceUtil::Timer();
        _timer = new IceUtil::Timer();

        //
        // If an Ice metrics observer is setup on the communicator, also
        // enable metrics for IceStorm.
        //
        IceInternal::CommunicatorObserverIPtr o =
            IceInternal::CommunicatorObserverIPtr::dynamicCast(communicator->getObserver());
        if(o)
        {
            _observer = new TopicManagerObserverI(o->getFacet());
        }
    }
    catch(...)
    {
        shutdown();
        destroy();
        __setNoDelete(false);

        throw;
    }
    __setNoDelete(false);
}
开发者ID:zhangwei5095,项目名称:ice,代码行数:67,代码来源:Instance.cpp


注:本文中的ice::CommunicatorPtr::getObserver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。