本文整理汇总了C++中Transport::invalidate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transport::invalidate方法的具体用法?C++ Transport::invalidate怎么用?C++ Transport::invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transport
的用法示例。
在下文中一共展示了Transport::invalidate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoteNodeSuspectException
void Codec20::checkForErrorsInResponseStatus(Transport& transport, HeaderParams& params, uint8_t status) const {
try {
switch (status) {
case HotRodConstants::INVALID_MAGIC_OR_MESSAGE_ID_STATUS:
case HotRodConstants::REQUEST_PARSING_ERROR_STATUS:
case HotRodConstants::UNKNOWN_COMMAND_STATUS:
case HotRodConstants::SERVER_ERROR_STATUS:
case HotRodConstants::COMMAND_TIMEOUT_STATUS:
case HotRodConstants::UNKNOWN_VERSION_STATUS: {
// If error, the body of the message just contains a message
std::string msgFromServer = transport.readString();
if (msgFromServer.find("SuspectException") != std::string::npos || msgFromServer.find("SuspectedException") != std::string::npos) {
// Handle both Infinispan's and JGroups' suspicions
// TODO: This will be better handled with its own status id in version 2 of protocol
throw RemoteNodeSuspectException(msgFromServer, params.messageId, status);
} else {
throw HotRodClientException(msgFromServer); //, params.messageId, status);
}
}
default: {
throw InternalException("Unknown status: " + status);
}
}
} catch (const Exception &) {
// Some operations require invalidating the transport
switch (status) {
case HotRodConstants::INVALID_MAGIC_OR_MESSAGE_ID_STATUS:
case HotRodConstants::REQUEST_PARSING_ERROR_STATUS:
case HotRodConstants::UNKNOWN_COMMAND_STATUS:
case HotRodConstants::UNKNOWN_VERSION_STATUS: {
transport.invalidate();
}
}
throw;
}
}