private void ProcessQueue() { #region Access Log #if TRACE { COM.Handler.LogHandler.Tracking("Access Method: " + this.GetType().ToString() + "->" + ((object)MethodBase.GetCurrentMethod()).ToString() + " ;"); } #endif #endregion Access Log DistributeMessageToFamilyDelegate callback = null; int cnt = 0; do { Thread.Sleep(25); do { this.allDone.Reset(); cnt = this.replicationQueue.Count; if (cnt > 0) { #region Handle paralell replication logic COM.IndexusMessage msg = null; long id = -1; #region enqueue it here and send msg to distribute as argument lock (bulkObject) { msg = this.replicationQueue.Dequeue(); } #endregion if (msg != null) { if (!resendCount.ContainsKey(msg.Id)) { resendCount.Add(msg.Id, new ResendControlState(0)); } else { ResendControlState state = null; lock (bulkObject) { state = resendCount[msg.Id]; } if (state != null) { TimeSpan sp = DateTime.Now.Subtract(state.lastTry); if (sp.TotalMilliseconds < 250) { // Console.WriteLine("Not ready to resend!!! wait more time!!"); lock (bulkObject) { this.replicationQueue.Enqueue(msg); break; } } } } if (ServiceLogic.ServerFamily != null && ServiceLogic.ServerFamily.Count > 0) { // Loop through all available server foreach (string host in ServiceLogic.ServerFamily) { try { #region replicate to server nodes / familiy members if (msg.Status == SharedCache.WinServiceCommon.IndexusMessage.StatusValue.ReplicationRequest) { msg.ClientContext = false; msg.Hostname = host; callback = new DistributeMessageToFamilyDelegate(this.DistributeMessageToFamily); object[] args = new object[1] { msg }; this.threadPool.PostRequest(callback, args); } #endregion } catch (Exception ex) { // ??? } } } else { #region string msgNoServerAvailable = string.Format("could not call object distribution - Family Mode: {0}; Configured installation amount within network: {1}; IP:{2}:{3};", this.enableServiceFamilyMode, ServiceLogic.ServerFamily.Count, this.cacheIpAdress, this.cacheIpPort); COM.Handler.LogHandler.Error(msgNoServerAvailable); #if DEBUG Console.WriteLine(msgNoServerAvailable); #endif #endregion } } #endregion this.allDone.WaitOne(); } } while (cnt > 0); } while (true); }