Esempio n. 1
0
bool JIceNotify::setCurrentService(const std::string &service)
{
    //
    const QString _service = QString::fromStdString(service);
    const std::string host = _service.section(':', 0, 0, QString::SectionSkipEmpty).trimmed().toStdString();
    const unsigned int port = _service.section(':', 1, 1, QString::SectionSkipEmpty).toUInt();

    //
    return setCurrentService(host, port);
}
Esempio n. 2
0
void Dispatcher::dispatchRequest( unsigned int uCommand,PushFramework::LogicalConnection* pClient,IncomingPacket& packet,unsigned int serviceBytes )
{
    //StopWatch dispatchWatch(m_QPFrequency);

    serviceMapT::iterator it = serviceMap.find(uCommand);
    if (it == serviceMap.end())
        return;
    //
    Service* pHandler = it->second->pService;

    //wcout << L"Locating Service : " << dispatchWatch.GetElapsedTime(false) << std::endl;

    //Mark dispatched service :

    setCurrentService(it->second->serviceName);

    StopWatch watch;
    pHandler->handle(pClient, &packet);


    double duration = watch.GetElapsedTime();
    /*	wcout << L"Service Time : " << watch.GetElapsedTime() << std::endl;
     */


    //StopWatch statsClock(m_QPFrequency);
    stats.addToDistribution(ServerStats::PerformanceProcessingTimePerService, it->second->serviceName, duration);
    //wcout << L"Stat 1 : " << statsClock.GetElapsedTime(false) << std::endl;

    stats.addToDuration(ServerStats::PerformanceProcessingTime, duration);
    //wcout << L"Stat 2 : " << statsClock.GetElapsedTime(false) << std::endl;

    UnsetCurrentService();

    //Stats. :

    stats.addToDistribution(ServerStats::BandwidthInboundVolPerRequest, it->second->serviceName, serviceBytes);
    //wcout << L"Stat 3 : " << statsClock.GetElapsedTime(false) << std::endl;


    stats.addToDistribution(ServerStats::PerformanceRequestVolPerRequest, it->second->serviceName, 1);
    //wcout << L"Stat 4 : " << statsClock.GetElapsedTime(false) << std::endl;


    //wcout << L"Dispatch Time : " << dispatchWatch.GetElapsedTime() << std::endl;
}
Esempio n. 3
0
bool JIceNotify::initialize(const std::string &service, const std::string &host, unsigned int port)
{
    bool result = true;

    //
    q_service = service;
    q_host = host;
    q_port = port;

    //
    try {
        // arguments
        const QStringList args = QApplication::arguments();
        ::Ice::StringSeq _args;
        QStringListIterator citerArgs(args);
        while (citerArgs.hasNext()) {
            _args.push_back(citerArgs.next().toStdString());
        }
        //
        q_commPtr = ::Ice::initialize(_args);
        if (!q_commPtr) {
            throw "invalid communicator!";
        }
        // serice
        QThreadPool::globalInstance()->start(this);

        // client
        if (!setCurrentService(host, port)) {
            //return false;
        }
    }
    catch (const Ice::Exception& e) {
        std::cout << e << std::endl;
        return false;
    }
    catch (const char* msg) {
        std::cout << msg << std::endl;
        return false;
    }

    return result;
}
Esempio n. 4
0
void ServiceChooser::onServiceChanged(const QByteArray &name, QObject *newObject, QObject *oldObject)
{
	if (name == m_service && oldObject->metaObject()->className() == m_currentService)
		setCurrentService(newObject->metaObject()->className());
}