示例#1
0
 /// <summary>
 /// Roles the environment stopping.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoleEnvironmentStoppingEventArgs"/> instance containing the event data.</param>
 private void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     try
     {
         Debug.WriteLine("AzureWorkerRole Stopping called");
     }
     catch (Exception)
     {
     }
 }
示例#2
0
 void RoleEnvironment_Stopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     WorkerTrace.TraceEvent(TraceEventType.Information, 16, "Role is stopping");
     stopRequested.Set();
     // Wait until processing stops
     if (current != null)
     {
         current.Abandon();
     }
     WorkerTrace.TraceEvent(TraceEventType.Information, 17, "Stopping FetchWorker");
     Thread.Sleep(25); //waiting for logs transfer
 }
示例#3
0
        //Event Handler
        public void RoleInstanceShutdown(object sender, RoleEnvironmentStoppingEventArgs e)
        {
            const string semaphoreName = "SemaphoreShutDown";
            Semaphore sem = null;

            // Attempt to open the named semaphore.
            try
            {
                sem = Semaphore.OpenExisting(semaphoreName);
            }
            catch (WaitHandleCannotBeOpenedException)
            {
                return;
            }
            sem.Release(1);
            Thread.Sleep(15000);
        }
 /// <summary>
 /// Occurs when a role instance is about to be stopped.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">Represents the arguments for the Stopping event, which occurs when a role instance is being stopped. </param>
 private static void RoleEnvironment_Stopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     try
     {
         // TraceIn
         TraceEventSource.Log.TraceIn();
     }
     catch (Exception ex)
     {
         // Trace Exception
         TraceEventSource.Log.TraceError(ex.Message, ex.InnerException?.Message ?? string.Empty);
     }
     finally
     {
         // TraceOut
         TraceEventSource.Log.TraceOut();
     }
 }
 private static void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Trace.TraceInformation("In RoleEnvironmentStopping");
 }
示例#6
0
 private void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Tracer.WriteLine("RoleEnvironmentStopping ", "Information");
     log.WriteEntry("RoleEnvironmentStopping", "", GetLabel());
 }
示例#7
0
文件: WebRole.cs 项目: akoltz/ggcbnet
 void RoleEnvironment_Stopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     if (!Config.Get().InDevelopmentEnvironment)
     {
         Log.TraceEvent(TraceEventType.Critical, 0, "Web role {0} is stopping", RoleEnvironment.CurrentRoleInstance.Id);
     }
 }
示例#8
0
 private void HandleAzureRoleStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     // Try to perform gracefull shutdown of Silo when we detect Azure role instance is being stopped
     logger.Info(ErrorCode.SiloStopping, "HandleAzureRoleStopping - starting to shutdown silo");
     host.StopOrleansSilo();
 }
示例#9
0
 private void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Tracer.WriteLine("RoleEnvironmentStopping ", "Information");
     log.WriteEntry("RoleEnvironmentStopping", "", GetLabel());
 }
示例#10
0
 private void OnRoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Trace.WriteLine(RoleEnvironment.CurrentRoleInstance.Role.Name + " is stopping...", "Information");
 }
示例#11
0
        //Event Handler
        public void RoleInstanceShutdown(object sender, RoleEnvironmentStoppingEventArgs e)
        {

            myHost.deActivateHosts();
            ConfigUtility.writeConsoleMessage("\nWorker Role RoleInstanceShutdown: Node ID: " + AzureUtility.getRoleInstanceID() + " Has Shut Down. Goodbye!\n", EventLogEntryType.Warning, true, new Settings());

        }
示例#12
0
 // Event handler for roleinstance stopping event
 private static void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Trace.TraceError("Roleinstance stopping, hence terminating file synchronization.");
     Environment.Exit(-1);
 }
 // Event handler for roleinstance stopping event
 private static void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Trace.TraceError("Roleinstance stopping, hence terminating file synchronization.");
     Environment.Exit(-1);
 }
 private void OnRoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e)
 {
     Trace.WriteLine(RoleEnvironment.CurrentRoleInstance.Role.Name + " is stopping...", "Information");
 }
示例#15
0
        private void RoleEnvironment_Stopping(object sender, RoleEnvironmentStoppingEventArgs e)
        {
            lock (MainSequencerLock)
            {
                Trace.TraceWarning("Role environment stopping notification received - Instance will stop in a few minutes");
                ReplicaSetRoleManager.SetState(ReplicaSetRoleManager.ReplicaSetRoleState.InstanceStopping);

                // On sait qu'on va s'arreter, désinscription auprès de la config pour sortir du replicaset et shard
                do
                {
                    Trace.TraceInformation("Instance stopping - Stopping MongoD process...");
                    MongoHelper.Shutdown(MongoDBAzurePlatform.Instance.MyMongoDAddress);
                    try
                    {
                        Stopwatch stopWatch = new Stopwatch();
                        stopWatch.Start();

                        //Trying to stop mongoD. Sometimes mongoD is deaf so if it did not stop after the defined timeout, we try again
                        while (!this.mongoProcess.HasExited && (stopWatch.Elapsed < MongoDShutdownTimeout))
                            Thread.Sleep(50);

                        if (!this.mongoProcess.HasExited)
                        {
                            Trace.TraceWarning("Instance stopping - MongoD did not want to stop. Retrying...");
                        }
                    }
                    catch (Exception ee)
                    {
                        // InvalidOperationException could be throw when There is no process associated with the object.
                        // http://msdn.microsoft.com/en-us/library/system.diagnostics.process.hasexited.aspx
                        Trace.TraceError("Instance stopping - Exception while stopping MongoD : " + ee.Message);
                    }
                } while (!this.mongoProcess.HasExited);
                Trace.TraceInformation("Instance stopping - MongoD process exited successfully");

                Trace.TraceInformation("Instance stopping - Unmounting drive...");
                try
                {
                    if (mongoDrive != null)
                    {
                        mongoDrive.Unmount();

                    }
                    //TODO: We must broadcast a message to alert a pool instance to mount the disk.

                    Trace.TraceInformation("Instance stopping - Drive unmounted successfully, unregistering instance...");
                    RemoveIpMapping();
                }
                catch (Exception ee)
                {
                    Trace.TraceError(string.Format("Instance stopping - Error while umounting drive {0} : {1}", mongoDrive == null ? "(unknown)" : mongoDrive.LocalPath, ee.Message));
                }

                Trace.TraceInformation("Instance stopping - Instance unregistered successfully - end of operation");
            }
        }
示例#16
0
        /// <summary>
        /// ON STOPPING
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RoleEnvironment_Stopping(object sender, RoleEnvironmentStoppingEventArgs e)
        {
            lock (MainSequencerLock)
            {
                // Flag the instance as stopping
                SetCurrentState(RoutingConfigRoleState.Stopping);

                Trace.TraceWarning("Role environment stopping notification received - Instance will stop in a few minutes");

                Trace.TraceWarning("The instance is stopping : shutting down MongoS process");
                MongoHelper.Shutdown(MongoDBAzurePlatform.Instance.MyMongoSAddress);

                Trace.TraceInformation("The instance is stopping : updating MongoS process status to 'stopped'");
                MongoHelper.UpdateInstance(MongoHelper.RoutingConfigRoleMongoProcessState.Stopped, "mongos");

                if (MongoDBAzurePlatform.Instance.MyFunctionnalRoutingRole == MongoDBAzurePlatform.FunctionnalRoutingRole.RoutingAndConfigRole)
                {
                    Trace.TraceWarning("The instance is stopping : shutting down MongoC process");
                    MongoHelper.Shutdown(MongoDBAzurePlatform.Instance.MyMongoCAddress);
                    try
                    {
                        while (!this.mongoConfigProcess.HasExited)
                            Thread.Sleep(50);
                    }
                    catch (Exception)
                    {
                        // InvalidOperationException could be throw when There is no process associated with the object.
                        // http://msdn.microsoft.com/en-us/library/system.diagnostics.process.hasexited.aspx
                    }
                    Trace.TraceInformation("The instance is stopping : updating MongoC instance status to 'stopped'");
                    MongoHelper.UpdateInstance(MongoHelper.RoutingConfigRoleMongoProcessState.Stopped, "mongoc");

                    Trace.TraceInformation("The instance is stopping : Unmounting MongoC data drive");
                    try
                    {
                        mongoDrive.Unmount();
                    }
                    catch (Exception) { }
                }
                Trace.TraceInformation("The instance is stopping : end of operations");
            }
        }