internal void AddMessage(MQTSH tsh) { uint method = 0x607; this.TrEntry(method, new object[] { tsh }); try { MQASYNC_MESSAGE async = new MQASYNC_MESSAGE(); tsh.Offset = async.ReadStruct(tsh.TshBuffer, tsh.Offset); base.TrData(method, 0, "Hobj to be removed", BitConverter.GetBytes(async.asyncMsg.hObj)); MQProxyQueue queue = this.FindProxyQueue(async.asyncMsg.hObj); if (queue == null) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Unable to find proxy queue for Hobj"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); throw exception; } queue.AddMessage(tsh, async); } finally { base.TrExit(method); } }
private bool ShouldDriveNoMsgs(MQProxyQueue pq) { bool flag = false; if (this.waitQ) { long noMsgTime = pq.NoMsgTime; int waitInterval = pq.MqcbGmo.WaitInterval; if (noMsgTime == 0L) { pq.NoMsgTime = this.now + waitInterval; } long num3 = noMsgTime - this.now; if (num3 <= 0L) { flag = true; pq.NoMsgTime = this.now + waitInterval; if ((this.noMsgsWait > waitInterval) || (this.noMsgsWait == 0)) { this.noMsgsWait = waitInterval; } return(flag); } if ((this.noMsgsWait <= num3) && (this.noMsgsWait != 0)) { return(flag); } this.noMsgsWait = (int)num3; } return(flag); }
public bool CheckClientEmpty() { uint method = 0x609; this.TrEntry(method); bool result = false; foreach (object obj2 in this.proxyQueues.Values) { MQProxyQueue queue = (MQProxyQueue)obj2; if (((queue != null) && queue.IsCbAlreadyRegistered) && ((queue.Status & 0x40000) == 0)) { if (!queue.IsEmpty()) { base.TrExit(method, false, 1); return(false); } if ((queue.Status & 0x10000000) != 0) { result = true; } } } base.TrExit(method, result, 2); return(result); }
internal void ReceiveNotification(MQTSH tsh) { uint method = 0x608; this.TrEntry(method, new object[] { tsh }); try { MQNOTIFICATION notification = new MQNOTIFICATION(); notification.ReadStruct(tsh.TshBuffer, tsh.Offset); MQProxyQueue queue = this.FindProxyQueue(notification.notify.hObj); if (queue == null) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Unable to find proxy queue for Hobj"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); throw exception; } queue.ReceiveNotification(notification); } finally { base.TrExit(method); } }
public void DeleteProxyQueue(MQProxyQueue proxyQueue) { uint method = 0x606; this.TrEntry(method, new object[] { proxyQueue }); try { this.deletePQueue.Acquire(); ManagedHobj manHobj = proxyQueue.ManHobj; if (manHobj != null) { int handle = manHobj.Handle; base.TrData(method, 0, "Hobj to be removed", BitConverter.GetBytes(handle)); MQProxyQueue queue = this.proxyQueues[handle]; if (queue != proxyQueue) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Couldn't find the ProxyQueue.."; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); base.TrException(method, ex); throw ex; } this.proxyQueues.Remove(handle); } } finally { this.deletePQueue.Release(); base.TrExit(method); } }
public void Dispose(bool fromDispose) { int compCode = 0; int reason = 0; if (((this.recoveryHobj != null) && (this.recoveryHobj.HOBJ != null)) && (this.recoveryHobj.HOBJ.Handle != -1)) { base.TrText("Hobj = " + this.recoveryHobj.HOBJ.Handle); MQProxyQueue proxyQueue = ((ManagedHobj)this.recoveryHobj.HOBJ).ProxyQueue; if (proxyQueue != null) { proxyQueue.ProxyMQCLOSE(0, ref compCode, ref reason); } else { this.recoveryHconn.GetMQFAP.MQCLOSE(this.recoveryHconn, this.recoveryHobj, 0, out compCode, out reason); } } this.recoveryHconn = null; this.recoveryHobj = null; this.TransactionLogList = null; this.recoveryProperties = null; if (!fromDispose) { GC.SuppressFinalize(this); } }
private void DeliverMsgs(MQProxyQueue pq) { pq.DeliverMsgs(ref this.processed); if (this.waitQ) { pq.NoMsgTime = this.now + pq.MqcbGmo.WaitInterval; if ((this.noMsgsWait > pq.MqcbGmo.WaitInterval) || (this.noMsgsWait == 0)) { this.noMsgsWait = pq.MqcbGmo.WaitInterval; } } }
public ManagedHobj(NmqiEnvironment env, int hobjInteger, MQProxyQueue proxyQueue, string objectName, int objectType, int openOptions, int defaultPersistence, int defaultPutReponseType, int defaultReadAhead, int defaultPropertyControl, MQObjectDescriptor objectDescriptor) : base(env) { base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { env, hobjInteger, proxyQueue, objectName, objectType, openOptions, defaultPersistence, defaultPutReponseType, defaultReadAhead, defaultPropertyControl, objectDescriptor }); this.value_ = hobjInteger; this.proxyQueue = proxyQueue; this.objectName = objectName; this.objectType = objectType; this.openOptions = openOptions; this.defaultPersistence = defaultPersistence; this.defaultPutResponseType = defaultPutReponseType; this.defaultReadAhead = defaultReadAhead; this.objectDescriptor = objectDescriptor; this.defaultPropertyControl = defaultPropertyControl; }
public MQProxyQueue CreateProxyQueue() { uint method = 0x603; this.TrEntry(method); MQProxyQueue result = null; try { result = new MQProxyQueue(base.env, this.hconn); } finally { base.TrExit(method, result); } return(result); }
internal void LogCurrentTransactionEnd(MQXid xid, int rmid) { uint method = 0x52c; this.TrEntry(method, new object[] { xid, rmid }); MQMessageDescriptor msgDesc = new MQMessageDescriptor(); msgDesc.Version = 2; try { if (this.TransactionLogList.ContainsKey(xid)) { MQMessageDescriptor descriptor2 = (MQMessageDescriptor)this.TransactionLogList[xid]; msgDesc.MsgId = descriptor2.MsgId; base.TrText(method, "MessageId-" + NmqiTools.ArrayToHexString(msgDesc.MsgId)); int dataLength = 0; int bufferLength = 0x1000; byte[] buffer = new byte[bufferLength]; int compCode = 0; int reason = 0; MQProxyQueue proxyQueue = ((ManagedHobj)this.recoveryHobj.HOBJ).ProxyQueue; if (proxyQueue != null) { proxyQueue.ProxyMQGET(msgDesc, this.recoveryGetGmo, bufferLength, buffer, ref dataLength, null, ref compCode, ref reason); } else { this.recoveryHconn.GetMQFAP.MQGET(this.recoveryHconn, this.recoveryHobj.HOBJ, msgDesc, this.recoveryGetGmo, bufferLength, buffer, out dataLength, out compCode, out reason); } if (compCode != 0) { base.throwNewMQException(compCode, reason); } this.TransactionLogList.Remove(xid); buffer = null; } } finally { base.TrExit(method); } }
public void SetIdentifier(MQProxyQueue proxyQueue, ManagedHobj hobj, int opOpts, int defRA) { uint method = 0x605; this.TrEntry(method, new object[] { proxyQueue, hobj.Value, opOpts, defRA }); try { this.synchornize.Acquire(); proxyQueue.SetIdentifier(hobj, opOpts, defRA); if (this.proxyQueues.ContainsKey(hobj.Handle)) { this.proxyQueues[hobj.Handle] = proxyQueue; } else { this.proxyQueues.Add(hobj.Handle, proxyQueue); } } finally { this.synchornize.Release(); base.TrExit(method); } }
private MQProxyQueue FindProxyQueue(int clientId) { uint method = 0x604; this.TrEntry(method, new object[] { clientId }); MQProxyQueue queue = null; try { this.findingPQueue.Acquire(); try { queue = this.proxyQueues[clientId]; } catch (KeyNotFoundException) { } if (queue == null) { NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.hconn.Session.ParentConnection.NegotiatedChannel.ChannelName.Trim(); CommonServices.CommentInsert2 = "No proxy queue with ClientId "; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); base.TrException(method, ex); throw ex; } } finally { this.findingPQueue.Release(); base.TrExit(method); } return(queue); }
public void Run() { uint method = 0x3b9; this.TrEntry(method); this.threadName = "DispatchThread: [" + this.hconn + "]"; Thread.CurrentThread.Name = this.threadName; base.TrText(method, "Dispatcher's name = " + this.threadName); Thread.SetData(Thread.GetNamedDataSlot("MQ_CLIENT_THREAD_TYPE"), 2); int num2 = 0; int num3 = 0; try { this.hconn.RequestThreadLock(); this.hconn.ReleaseThreadLock(); while (!this.exitThread) { num2 = 0; this.savedDispatchSeq = this.dispatchSeq; this.noMsgsWait = 0; if (this.hconnActive) { this.hconn.RequestDispatchLock(-1); try { this.ProcessHconn(); if ((this.hconnActive && this.hconn.IsStarted()) && !this.hconn.IsSuspended()) { this.processed = 0; num3 = 0; MQProxyQueue[] getDispatchQueueList = this.hconn.GetDispatchQueueList; for (int i = 0; i < getDispatchQueueList.Length; i++) { MQProxyQueue pq = getDispatchQueueList[i]; this.waitQ = (pq.MqcbGmo.WaitInterval > 0) && ((pq.MqcbGmo.Options & 1) != 0); if (this.waitQ) { this.now = DateTime.Now.Millisecond; } IntPtr callbackFunction = pq.MqcbCBD.CallbackFunction; if ((pq.Status & 0x40000) == 0) { if (pq.EventsRaised != this.hconn.EventsHad) { pq.DriveEventsMC(); } if (!pq.IsEmpty()) { this.DeliverMsgs(pq); } else if (this.ShouldDriveNoMsgs(pq) || pq.CallbackOnEmpty()) { pq.CallConsumer(5, 2, 0x7f1); pq.UnsetCallbackOnEmpty(); } if (this.hconn.ConsumersChanged()) { this.hconn.DriveOutstanding(); } if ((pq.Status & 0x80) != 0) { if (this.processed != 0) { num3++; } } else { num3++; } if ((pq.Status & 0x80000) != 0) { this.hconn.RemoveFromDispatchList(pq); this.hconn.ProxyQueueManager.DeleteProxyQueue(pq); } } num2 += this.processed; getDispatchQueueList = this.hconn.GetDispatchQueueList; } } } finally { if (this.hconn != null) { try { this.hconn.ReleaseDispatchLock(); } catch (SynchronizationLockException) { } } } Thread.Sleep(0); } if ((num2 == 0) && (this.savedDispatchSeq == this.dispatchSeq)) { this.hconn.RequestThreadLock(); try { if (this.savedDispatchSeq != this.dispatchSeq) { continue; } this.status |= 1; } finally { this.hconn.ReleaseThreadLock(); } this.SleepPhase(); } } } catch (Exception exception) { NmqiException ex = null; if ((exception is NmqiException) || (exception is MQException)) { if (exception is MQException) { ex = new NmqiException(base.env, -1, null, ((MQException)exception).CompCode, ((MQException)exception).Reason, exception); } else { ex = (NmqiException)exception; } if (ex.Reason == 0x893) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)this.status; CommonServices.CommentInsert1 = exception.Message; CommonServices.CommentInsert2 = exception.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); } base.TrException(method, ex); throw ex; } CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)this.status; CommonServices.CommentInsert1 = exception.Message; CommonServices.CommentInsert2 = exception.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); base.TrException(method, exception); throw exception; } finally { base.TrExit(method); } }