public void RemoveSession(Session session, bool isTermination) { //MethodBase methodInfo = MethodBase.GetCurrentMethod(); if (this.BeginRemoveSession != null) this.BeginRemoveSession(MethodRemoveSession, new object[] { session, isTermination }); #region trash // 'release part-uut binding cache // BindingCacheManager.GetInstance.removeBindingByValue(session.Key) // 'release shipping 05 cache // ICZUnitCacheManager.GetInstance.removeBindingByValue(session.Key) // 'release shipping pallete cache // If session.Type = SessionType.SESSION_SHIPPING Then // Dim pallet As Object = session.GetValue(SessionKey.Pallet) // If Not pallet Is Nothing AndAlso TypeOf pallet Is Pallet Then // Dim palletNo As String = CType(pallet, Pallet).PalletNo // ShippingPalletCacheManager.GetInstance.removeBinding(palletNo) // End If // End If // 'release pvs ckpo preorder // If session.Type = SessionType.SESSION_TYPE_PO And isTermination Then // If session.GetValue(SessionKey.CKPreOrdered) = True Then // Dim ckpo As Object = session.GetValue(SessionKey.CKPO) // If Not ckpo Is Nothing Then // CType(ckpo, CKPO).countermand("") // End If // End If // End If #endregion Monitor.Enter(this._synObjSessions); try { session.SetSessionCompleted(); string gKey = Session.GetGlobalSessionKey(session); this._sessionCache.Remove(gKey); this._wfIDKeyMap.Remove(session.Id); //Vincent 2014-11-17 first step release wf & host thread session.ResumeHost(); session.ResumeWorkFlow(); } catch (Exception ex) { if (this.ErrorInRemoveSession != null) this.ErrorInRemoveSession(MethodRemoveSession, new object[] { session, isTermination }, ex); } finally { Monitor.Exit(this._synObjSessions); if (this.EndRemoveSession != null) this.EndRemoveSession(MethodRemoveSession, new object[] { session, isTermination }); } //Vincent add: check Terminate flag //if (isTermination) //{ this.TerminateWF(session); //} }