Esempio n. 1
0
 void SearchLogicManagerI::update(const UpdateUnitSeq& updateUnits, const Ice::Current& ic) {
   const Ice::ConnectionPtr con = ic.con;
   if (con.get() != NULL) {
     MCE_DEBUG("SearchLogicManagerI::update" << updateUnits.size() << " objects. invoker is :" << con->toString()  << ", facet=" << ic.facet << ", operation=" << ic.operation << ", requestId=" << ic.requestId << ", id.name=" << ic.id.name << ", id.category=" << ic.id.category << ", adapter.name=" << ic.adapter->getName());
   }
   if (updateUnits.empty())
     return;
   for(UpdateUnitSeq::const_iterator iter=updateUnits.begin(); iter!=updateUnits.end(); ++iter) {
     int user_id = iter->id;
     if (user_id >= 0) {
       (_vecMessageQueueThread.at(user_id % kMessageQueueThreadNum))->invoke(*iter);
     }
   }
 }
Esempio n. 2
0
Int2SearchCacheResultMap SearchCacheManagerI::getSearchCacheList(const ::MyUtil::IntSeq& userIds, const Ice::Current& ic) {

    struct timeval tvStart;
    struct timeval tvStart1;
    struct timeval tvEnd;
	MyUtil::LongSeq uids;

    gettimeofday(&tvStart, NULL);

	Int2SearchCacheResultMap result;
	for (MyUtil::IntSeq::const_iterator it = userIds.begin(); it!= userIds.end(); ++it) {
        BinStringPtr binStrPtr = ObjectCacheHelper::instance().findObject<BinStringPtr> (*it);
		if (binStrPtr.get() != NULL) {
            SearchMemCacheDataPtr pSCData = new SearchMemCacheData();
            char* pBuf = NULL;
            int len = 0;
            binStrPtr->getBuf(&pBuf, &len);

            if (pBuf==NULL || len <= 0) continue;

            if (pSCData->Unserialize(pBuf, len)) {
                result[*it] = pSCData->getProperties();
            }
		} else {
            //scq
            if (*it != 0) {
                uids.push_back(*it);
            }
		}
	}

    gettimeofday(&tvStart1, NULL);

    if (!uids.empty())
        _invokeLoad.invoke(uids);

    gettimeofday(&tvEnd, NULL);
    int start = tvStart.tv_sec*1000000 + tvStart.tv_usec;
    int start1 = tvStart1.tv_sec*1000000 + tvStart1.tv_usec;
    int end = tvEnd.tv_sec*1000000 + tvEnd.tv_usec;
    if ((end - start) > 5000) {
        const Ice::ConnectionPtr con = ic.con;
        if (con.get() != NULL) {
            MCE_INFO(con->toString() << " Get SearchCache List: time=" << end-start << "us " << 
                     "invokeLoad: time=" << end - start1 << "us total=" << userIds.size());
        }
    }
	return result;
}