コード例 #1
0
        private void RemoveFrontEnd(AppFrontEnd frontEnd)
        {
            Debug.Assert(frontEnd != null, "front end should not be null");

            lock (this.SyncRoot)
            {
                m_frontEnds.Remove(frontEnd);
            }
        }
コード例 #2
0
 public CallbackManager(AppFrontEnd appFrontEnd)
     : base(appFrontEnd.AppPlatform)
 {
     m_appFrontEnd            = appFrontEnd;
     m_cleanupTimer           = new Timer(m_cleanupIntervalSpan.TotalMilliseconds);
     m_cleanupTimer.AutoReset = true;
     m_cleanupTimer.Elapsed  += this.CleanupElapsed;
     m_pendingRequests        = new LinkedList <CallbackRequest>();
 }
コード例 #3
0
 private void ShutdownFrontEnd(AsyncTask task, object state)
 {
     task.DoOneStep(
         delegate()
     {
         AppFrontEnd frontEnd = (AppFrontEnd)state;
         this.Logger.Log(Logger.LogLevel.Info, String.Format("Sutting down FrontEnd {0}.", frontEnd.Endpoint.OwnerUri));
         frontEnd.BeginShutdown(
             delegate(IAsyncResult ar)
         {
             task.DoFinalStep(
                 delegate()
             {
                 frontEnd.EndShutdown(ar);
                 this.Logger.Log(Logger.LogLevel.Info, String.Format("FrontEnd {0} shutdown.", frontEnd.Endpoint.OwnerUri));
             });
         },
             null);
     });
 }
コード例 #4
0
        private void ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e)
        {
            AppFrontEnd frontEnd = null;

            if (this.IsTerminatingTerminated)
            {
                return;
            }
            lock (this.SyncRoot)
            {
                this.Logger.Log(Logger.LogLevel.Info, "A new endpoint was detected : " + e.ApplicationEndpointSettings.OwnerUri);
                frontEnd = new AppFrontEnd(this, e.ApplicationEndpointSettings);
                this.AddFrontEnd(frontEnd);
            }

            Debug.Assert(frontEnd != null, "frontEnd should not be null");

            try
            {
                frontEnd.BeginStartup(
                    ar =>
                {
                    try
                    {
                        frontEnd.EndStartup(ar);
                    }
                    catch (RealTimeException ex)
                    {
                        this.Logger.Log(Logger.LogLevel.Error, "Failed to start front end : ", ex);
                        this.RemoveFrontEnd(frontEnd);
                    }
                }, null);
            }
            catch (InvalidOperationException ex)
            {
                this.Logger.Log(Logger.LogLevel.Error, "Failed to start front end : ", ex);
                this.RemoveFrontEnd(frontEnd);
            }
        }