Opc.Ua.Server.SessionManager.RaiseSessionEvent C# (CSharp) Method

RaiseSessionEvent() protected method

Raises an event related to a session.
protected RaiseSessionEvent ( Session session, SessionEventReason reason ) : void
session Session
reason SessionEventReason
return void
        protected virtual void RaiseSessionEvent(Session session, SessionEventReason reason)
        { 
            lock (m_eventLock)
            {
                SessionEventHandler handler = null;

                switch (reason)
                {
                    case SessionEventReason.Created:   { handler = m_SessionCreated;   break; }
                    case SessionEventReason.Activated: { handler = m_SessionActivated; break; }
                    case SessionEventReason.Closing:   { handler = m_SessionClosing;   break; }
                }

                if (handler != null)
                {
                    try
                    {
                        handler(session, reason);
                    }
                    catch (Exception e)
                    {
                        Utils.Trace(e, "Session event handler raised an exception.");
                    }
                }
            } 
        }
        #endregion