Example #1
0
        private void ShutdownCollaborationPlatform(AsyncTask task, object state)
        {
            CollaborationPlatform platform = m_platform;

            if (platform == null)
            {
                task.Complete(null);
                return;
            }
            task.DoOneStep(
                delegate()
            {
                m_platform.BeginShutdown(
                    delegate(IAsyncResult ar)
                {
                    task.DoFinalStep(
                        delegate()
                    {
                        m_platform.EndShutdown(ar);
                        this.Logger.Log(Logger.LogLevel.Info, "Platform shutdown completed.");
                    });
                },
                    null);
            });
        }
Example #2
0
        private void EndPlatformShutdown(IAsyncResult ar)
        {
            CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;

            //Shutdown actions will not throw.
            collabPlatform.EndShutdown(ar);
            Console.WriteLine("The platform is now shutdown.");

            //Again, just to sync the completion of the code and the platform teardown.
            _waitForShutdownEventCompleted.Set();
        }
        public static void DisconnectOfficeCommunicationServer(UserEndpoint userEndpoint)
        {
            Console.WriteLine("Disconnecting from OCS...");

            userEndpoint.EndTerminate(userEndpoint.BeginTerminate(null, null));

            CollaborationPlatform platform = userEndpoint.Platform;

            platform.EndShutdown(platform.BeginShutdown(null, null));

            Console.WriteLine("\tSuccess");
        }
        private void EndPlatformShutdown(IAsyncResult ar)
        {
            CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;

            try
            {
                //Shutdown actions will not throw.
                collabPlatform.EndShutdown(ar);
                NonBlockingConsole.WriteLine("The platform is now shut down.");
            }
            finally
            {
                _platformShutdownCompletedEvent.Set();
            }
        }
        // Callback referenced in the BeginShutdown method on the platform.
        private void PlatformShutdownCB(IAsyncResult ar)
        {
            CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;

            try
            {
                // Shutdown actions will not throw.
                collabPlatform.EndShutdown(ar);
                Console.WriteLine("The platform is now shut down.");
            }
            finally
            {
                _waitForPlatformShutdownCompleted.Set();
            }
        }
Example #6
0
 public void ShutdownPlatform()
 {
     if (collabPlatform != null)
     {
         try
         {
             Log.WriteLogEntry("INFO", String.Format("Shutting down {0} platform...", LumtGlobals.ApplicationShortName));
             collabPlatform.EndShutdown(collabPlatform.BeginShutdown(null, null));
             Log.WriteLogEntry("INFO", String.Format("{0} platform shut down.", LumtGlobals.ApplicationShortName));
         }
         catch (Exception ex)
         {
             Log.WriteLogEntry("ERROR", String.Format("{0} platform NOT shut down: {1}. Inner Exception: {2}", LumtGlobals.ApplicationShortName, ex.Message, (ex.InnerException == null ? "N/A" : ex.InnerException.Message)));
         }
     }
 }
Example #7
0
 // Method to shutdown the CollaborationPlatform.
 static void ShutdownPlatform()
 {
     _collabPlatform.BeginShutdown(ar =>
     {
         CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;
         try
         {
             collabPlatform.EndShutdown(ar);
             Console.WriteLine("The platform is now shut down.");
         }
         catch (RealTimeException realTimeEx)
         {
             Console.WriteLine("RealTimeException: " + realTimeEx.ToString());
         }
     },
                                   _collabPlatform);
 }
Example #8
0
        // Callback for CollaborationPlatform's BeginShutdown().
        void EndPlatformShutdown(IAsyncResult ar)
        {
            CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;

            try
            {
                collabPlatform.EndShutdown(ar);
                Console.WriteLine("The platform is now shut down.");
            }
            catch (RealTimeException realTimeEx)
            {
                // RealTimeException may be thrown as a result of any
                // UCMA operation.
                // TODO (Left to the reader): Error handling code.
                Console.WriteLine("RealTimeException : " + realTimeEx.ToString());
            }
        }
Example #9
0
        /// <summary>
        /// Callback method for platform shutdown method
        /// </summary>
        /// <param name="result">Async result</param>
        private void PlatformShutdownCompleted(IAsyncResult result)
        {
            CollaborationPlatform collabPlatform = result.AsyncState as CollaborationPlatform;

            try
            {
                //Shutdown actions will not throw.
                collabPlatform.EndShutdown(result);
            }
            finally
            {
                Helper.Logger.Info("The platform is now shutdown.");
                var allDone = m_allDone;
                if (allDone != null)
                {
                    allDone.Set();
                }
            }
        }
Example #10
0
        /// <summary>
        /// Callback from <code>BeginShutdown</code> method on platform.
        /// </summary>
        /// <param name="result">
        /// Status of the platform shutdown operation.
        /// </param>
        private void PlatformShutdownCompleted(IAsyncResult result)
        {
            // Extract the platform that was passed in as the state argument to
            // the BeginShutdown() method.
            CollaborationPlatform platform = result.AsyncState as CollaborationPlatform;

            if (platform == null)
            {
                UCMASampleHelper.WriteErrorLine(
                    "CollaborationPlatform not passed into BeginShutdown() method.");
                UCMASampleHelper.FinishSample();
                return;
            }

            // Determine whether the shutdown operation completed
            // successfully.
            platform.EndShutdown(result);

            UCMASampleHelper.WriteLine("The platform is now shut down.");
        }
            private static ApplicationEndpoint CreateEndPoint(ServerPlatformSettings settings)
            {
                CollaborationPlatform collaborationPlatform = new CollaborationPlatform(settings);

                collaborationPlatform.EndStartup(collaborationPlatform.BeginStartup(null, null));
                ApplicationEndpoint result;

                try
                {
                    ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(collaborationPlatform, new ApplicationEndpointSettings(BaseUMconnectivityTester.SipPlatformConnectionManager.OwnerUri));
                    applicationEndpoint.EndEstablish(applicationEndpoint.BeginEstablish(null, null));
                    result = applicationEndpoint;
                }
                catch (Exception)
                {
                    collaborationPlatform.EndShutdown(collaborationPlatform.BeginShutdown(null, null));
                    throw;
                }
                return(result);
            }
Example #12
0
        private void EndPlatformShutdown(IAsyncResult ar)
        {
            CollaborationPlatform collabPlatform = ar.AsyncState as CollaborationPlatform;

            try
            {
                //xueming add
                //_userEndpoint.EndEstablish();

                collabPlatform.EndShutdown(ar);
                //_collabPlatform.EndShutdown(ar);
                _userEndpoint      = null;
                _collabPlatform    = null;
                _isPlatformStarted = false;
            }
            finally
            {
                _platformShutdownCompletedEvent.Set();
            }
        }
Example #13
0
        /// <summary>
        /// OnPlatformShutdownComplete finishes shutting down the platform.
        /// </summary>
        internal void OnPlatformShutdownComplete(IAsyncResult result)
        {
            CollaborationPlatform platform = result.AsyncState as CollaborationPlatform;

            platform.EndShutdown(result);
        }