Beispiel #1
0
        internal void DisposeMembers()
        {
            //NOTE: This class has purposely been designed such that this method (and these members) do not need to be synchronized.
            //If you were to synchronize this method, it could deadlock with the other objects that can call
            //back into this class.

            try
            {
                if (_timer != null)
                {
                    _timer.Dispose();
                    _timer = null;
                }

                if (_synchronizationContext != null)
                {
                    _synchronizationContext.Dispose();
                    _synchronizationContext = null;
                }

                if (_context == null)
                {
                    return;
                }

                _context.Dispose();
                _context = null;
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Debug, e);
            }
        }
Beispiel #2
0
        internal void InternalStart(StartApplicationRequest request)
        {
            try
            {
                ProcessMetaInfo(request.MetaInformation);
                AuthenticateUser(request);
                _synchronizationContext = new WebSynchronizationContext(this);
                _synchronizationContext.Send(nothing => DoStart(request), null);
            }
            catch (Exception)
            {
                Logout();
                DisposeMembers();
                throw;
            }

            lock (_syncLock)
            {
                //DoStart can call Stop.
                if (_stop)
                {
                    return;
                }
            }

            _timer = new System.Threading.Timer(OnTimer, null, TimerInterval, TimerInterval);
        }