我有这个代码,它是我的BackgroundWorkerXMLPutMessages_DoWork
Sub 的一部分。
Try
PublicMQVariable.MQMessage_Reply = New MQMessage
PublicMQVariable.MQMessage_Reply.CorrelationId = PublicMQVariable.MQMessage_Request.MessageId
PublicMQVariable.MQMessage_Reply.MessageType = MQC.MQMT_REPLY
PublicMQVariable.MQGetMessageOptions_Reply = New MQGetMessageOptions
PublicMQVariable.MQGetMessageOptions_Reply.Options = MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING
PublicMQVariable.MQGetMessageOptions_Reply.MatchOptions = MQC.MQMO_MATCH_CORREL_ID
PublicMQVariable.MQGetMessageOptions_Reply.WaitInterval = My.Settings.MQ_ReplyTimeOut
PublicMQVariable.MyStopwatch = New Stopwatch
PublicMQVariable.MyStopwatch.Start()
PublicMQVariable.MQQueue_Response.Get(PublicMQVariable.MQMessage_Reply, PublicMQVariable.MQGetMessageOptions_Reply)
PublicMQVariable.MyStopwatch.Stop()
PublicMQVariable.MyReplyMessage = PublicMQVariable.MQMessage_Reply.ReadString(PublicMQVariable.MQMessage_Reply.MessageLength)
Catch ex As MQException
MsgBox("MQException: compCode: " & ex.CompCode.ToString() & " Reason: " + ex.Reason.ToString() & " - " & ex.Message)
MQDisconnectAndClose()
Return
End Try
执行此代码 ( ) 的那一刻PublicMQVariable.MQQueue_Response.Get(PublicMQVariable.MQMessage_Reply, PublicMQVariable.MQGetMessageOptions_Reply)
,它会返回到BackgroundWorkerXMLPutMessages_RunWorkerCompleted
没有完成上面的其余代码。
为什么会发生这种情况,我能做些什么来防止这种“过早完成”?