void ReloadFromTripodThread::run() { while (true) { KeySeq keysToReload; { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mutex_); if (this->keysToReload_.empty()) { mutex_.wait(); } keysToReload.insert(keysToReload.end(), this->keysToReload_.begin(), this->keysToReload_.end()); } if (!keysToReload.empty()) { this->tripodClient_->load(keysToReload, 2000, true); } } }
void ReloadFromTripodThread::run() { while (true) { KeySeq keysToReload; { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mutex_); if (this->keysToReload_.empty()) { mutex_.wait(); } keysToReload.insert(keysToReload.end(), this->keysToReload_.begin(), this->keysToReload_.end()); this->keysToReload_.clear(); } if (!keysToReload.empty()) { sleep(10); //MCE_INFO("[ReloadFromTripodThread::run] load keys.size = " << keysToReload.size()); this->tripodClient_->load(keysToReload, 2000, true); //刪除掉ObjectCache相应的内容,因为TripodCache已经是最新的了 vector<long> userIds = MenuCacheManagerI::convertStringSeq2LongSeq(keysToReload); ServiceI::instance().getObjectCache()->removeObjects(objCacheCategory_, userIds); } } }