如何解决actibemq-cpp:代理停止时,ActiveMQConnection :: createSession卡在sureConnectionConnection中
我的某些系统不会安装activeMQ代理,但是代码在那里。
我试图在ActiveMQConnection::ensureConnectionInfoSent : syncRequest(this->config->connectionInfo,500);
内添加超时
当代理处于活动状态时,它可以正常工作。但是,当我停止代理并尝试再次初始化连接时,它卡住了。
该函数的for包括我的prionts:
void ActiveMQConnection::ensureConnectionInfoSent() {
try {
// Can we skip sending the ConnectionInfo packet,cheap test
if (this->config->isConnectionInfoSentTobroker || closed.get()) {
return;
}
synchronized(&( this->config->ensureConnectionInfoSentMutex)) {
// Can we skip sending the ConnectionInfo packet??
if (this->config->isConnectionInfoSentTobroker || closed.get()) {
return;
}
// check for a user specified Id
if (!this->config->userSpecifiedClientID) {
this->config->connectionInfo->setClientId(this->config->clientIdGenerator->generateId());
}
// Now we ping the broker and see if we get an ack / nack
//syncRequest(this->config->connectionInfo,this->config->connectResponseTimeout);
fprintf(stdout,"talg ensureConnectionInfoSent before calling syncRequest\n");//talg
syncRequest(this->config->connectionInfo,1); /* talg */
fprintf(stdout,"talg ensureConnectionInfoSent after calling syncRequest\n");//talg
this->config->isConnectionInfoSentTobroker = true;
Pointer<SessionId> sessionId(new SessionId(this->config->connectionInfo->getConnectionId().get(),-1));
Pointer<ConsumerId> consumerId(new ConsumerId(*sessionId,this->config->consumerIdGenerator.getNextSequenceId()));
if (this->config->watchTopicAdvisories) {
fprintf(stdout,"talg inside ensureConnectionInfoSent 500\n");//talg
this->config->advisoryConsumer.reset(new AdvisoryConsumer(this,consumerId));
}
fprintf(stdout,"talg inside ensureConnectionInfoSent 2\n");//talg
}
fprintf(stdout,"talg inside ensureConnectionInfoSent 3\n");//talg
}
AMQ_CATCH_RETHROW(ActiveMQException)
AMQ_CATCH_EXCEPTION_CONVERT(Exception,ActiveMQException)
AMQ_CATCHALL_THROW(ActiveMQException)
fprintf(stdout,"talg end of ensureConnectionInfoSent\n");//talg
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。