| 174 | } |
| 175 | |
| 176 | int32_t TConcurrentClientSyncInfo::generateSeqId() |
| 177 | { |
| 178 | Guard seqidGuard(seqidMutex_); |
| 179 | if(stop_) |
| 180 | throwDeadConnection_(); |
| 181 | |
| 182 | if(!seqidToMonitorMap_.empty()) |
| 183 | if(nextseqid_ == seqidToMonitorMap_.begin()->first) |
| 184 | throw apache::thrift::TApplicationException( |
| 185 | TApplicationException::BAD_SEQUENCE_ID, |
| 186 | "about to repeat a seqid"); |
| 187 | int32_t newSeqId = nextseqid_; |
| 188 | if (nextseqid_ == (std::numeric_limits<int32_t>::max)()) |
| 189 | nextseqid_ = (std::numeric_limits<int32_t>::min)(); |
| 190 | else |
| 191 | ++nextseqid_; |
| 192 | seqidToMonitorMap_[newSeqId] = newMonitor_(seqidGuard); |
| 193 | return newSeqId; |
| 194 | } |
| 195 | |
| 196 | TConcurrentRecvSentry::TConcurrentRecvSentry(TConcurrentClientSyncInfo *sync, int32_t seqid) : |
| 197 | sync_(*sync), |
nothing calls this directly
no test coverage detected