private void CloseConversation(IConversationState conversation)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug(String.Format("CloseConversation: Id='{0}'", conversation.Id));
     }
     if (conversation.RootSessionPerConversation != null)
     {
         ISession tmpSession = conversation.RootSessionPerConversation;
         if (conversation.Ended)
         {
             SessionFactoryUtils.CloseSession(tmpSession);
             conversation.RootSessionPerConversation = null;
         }
         else
         {
             if (tmpSession.IsConnected)
             {
                 tmpSession.Disconnect();
             }
         }
         RemoveSession(tmpSession);
     }
     if (log.IsDebugEnabled)
     {
         log.Debug("Closed LazySessionPerConversationHolder");
     }
 }
Exemple #2
0
            private void CloseConversation(IConversationState conversation)
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug($"CloseConversation: Id='{conversation.Id}'");
                }

                if (conversation.RootSessionPerConversation != null)
                {
                    ISession tmpSession = conversation.RootSessionPerConversation;
                    if (conversation.Ended)
                    {
                        SessionFactoryUtils.CloseSession(tmpSession);
                        conversation.RootSessionPerConversation = null;
                    }
                    else
                    {
                        if (tmpSession.IsConnected)
                        {
                            IDbConnection conn = tmpSession.Disconnect();
                            if (conn != null && conn.State == ConnectionState.Open)
                            {
                                conn.Close();
                            }
                        }
                    }
                    RemoveSession(tmpSession);
                }
                if (log.IsDebugEnabled)
                {
                    log.Debug("Closed LazySessionPerConversationHolder");
                }
            }
 /// <summary>
 /// Ensure session is closed (if any) and remove circular references to avoid memory leaks!
 /// </summary>
 public void Close()
 {
     owner = null;
     if (session != null)
     {
         ISession tmpSession = session;
         session = null;
         SessionFactoryUtils.CloseSession(tmpSession);
     }
     if (log.IsDebugEnabled)
     {
         log.Debug("Closed LazySessionHolder");
     }
 }
Exemple #4
0
 private void CloseSession(ISession session)
 {
     SessionFactoryUtils.CloseSession(session);
 }