当前位置: 首页>>代码示例>>C#>>正文


C# RoleEnvironmentChangingEventArgs类代码示例

本文整理汇总了C#中RoleEnvironmentChangingEventArgs的典型用法代码示例。如果您正苦于以下问题:C# RoleEnvironmentChangingEventArgs类的具体用法?C# RoleEnvironmentChangingEventArgs怎么用?C# RoleEnvironmentChangingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RoleEnvironmentChangingEventArgs类属于命名空间,在下文中一共展示了RoleEnvironmentChangingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RoleEnvironmentChanging

 /// <summary>
 /// Event handler called when an environment change is to be applied to the role.
 /// Determines whether or not the role instance must be recycled.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The list of changed environment values.</param>
 private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     // If Azure should recycle the role, e.Cancel should be set to true.
     // If the changes are ones we can handle without a recycle, we set it to false.
     e.Cancel = this.RecycleConfiguration(e.Changes);
     Trace.WriteLine("WebRole environment change - role instance recycling: " + e.Cancel.ToString());
 }
开发者ID:wpdiary,项目名称:PolyGlotPersistence,代码行数:13,代码来源:WebRole.cs

示例2: RoleEnvironmentChanging

 private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     // If a configuration setting is changing
     if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
         // set e.Cancel to true to restart this role instance
         e.Cancel = true;
 }
开发者ID:eakova,项目名称:resizer,代码行数:7,代码来源:Webrole.cs

示例3: RoleEnvironmentChanging

 private static void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
     {
         e.Cancel = true;
     }
 }
开发者ID:Adron,项目名称:windowsazurefordevelopers,代码行数:7,代码来源:WorkerRole.cs

示例4: RoleEnvironmentChanging

        private static void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            if (!e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange)) return;

            Trace.WriteLine("Working", "Environment Change: " + e.Changes.ToList());
            e.Cancel = true;
        }
开发者ID:Adron,项目名称:windowsazurefordevelopers,代码行数:7,代码来源:WorkerRole.cs

示例5: RoleEnvironmentChanging

        //Event Handler
        public void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            var changes = from ch in e.Changes.OfType<RoleEnvironmentTopologyChange>()
                          select ch;
            if (changes.Any())
            {
                const string semaphoreName = "SemaphoreShutDown";
                Semaphore sem = null;

                // Attempt to open the named semaphore.
                try
                {
                    sem = Semaphore.OpenExisting(semaphoreName);
                }
                catch (WaitHandleCannotBeOpenedException)
                {
                    return;
                }
                sem.Release(1);

                //Note this may be superfulous, as this event may be running on a non-blocking thread.  To be investigated.
                //If a blocking thread, this gives some time for IIS to complete its shutdown, based on the semaphore release
                //above.  
                Thread.Sleep(20000);
            }
        }
开发者ID:vactorwu,项目名称:catch23-project,代码行数:27,代码来源:WebRole.cs

示例6: RoleEnvironmentChanging

 private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     //Are any of the environment changes a configuration setting change? If so, cancel the event and restart the role
     if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
     {
         e.Cancel = true;
     }
 }
开发者ID:Adron,项目名称:windowsazurefordevelopers,代码行数:8,代码来源:WebRole.cs

示例7: RoleEnvironmentChanging

 private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     e.Cancel = false; // don't restart for configuration changes
     /*if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
     {
         e.Cancel = true;
     }*/
 }
开发者ID:smarx,项目名称:NetflixPivot,代码行数:8,代码来源:WebRole.cs

示例8: RoleEnvironment_Changing

 static void RoleEnvironment_Changing(object sender, RoleEnvironmentChangingEventArgs e)
 {
     if (e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>().Count() > 0)
     {
         // Cancel the changing event to force role instance restart
         //e.Cancel = true;
     }
 }
开发者ID:CDLUC3,项目名称:dataup2,代码行数:8,代码来源:WebRole.cs

示例9: RoleEnvironmentChanging

 private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     // for any configuration setting change except EnableTableStorageTraceListener
     if (e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>().Any(change => change.ConfigurationSettingName != "EnableTableStorageTraceListener"))
     {
         // Set e.Cancel to true to restart this role instance
         e.Cancel = true;
     }
 }
开发者ID:st4l,项目名称:HOL-DebuggingCloudServices-VS2012,代码行数:9,代码来源:WebRole.cs

示例10: RoleEnvironmentChanging

        static void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            var i = 1;
            foreach (var c in e.Changes)
                Trace.WriteLine(string.Format("RoleEnvironmentChanging: #{0} Type={1} Change={2}", i++, c.GetType().FullName, c));

            if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
                e.Cancel = true;
        }
开发者ID:mekoda,项目名称:DesignPatterns,代码行数:9,代码来源:WorkerRole.cs

示例11: HandleRoleEnvironmentChanging

 private void HandleRoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     foreach(var c in e.Changes.OfType<RoleEnvironmentTopologyChange>())
     {
         if (c.RoleName.Equals(AzureConstants.StoreWorkerRoleName))
         {
             Trace.TraceInformation("BrightstarCluster: Received RoleEnvironmentTopologyChange event. Updating store worker client list");
             UpdateClientList();
         }
     }
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:11,代码来源:BrightstarCluster.cs

示例12: OnRoleEnvironmentChanging

        static void OnRoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            // we restart all workers if the configuration changed (e.g. the storage account)
            // for now.

            // We do not request a recycle if only the topology changed,
            // e.g. if some instances have been removed or added.
            var configChanges = e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>();

            if(configChanges.Any())
            {
                RoleEnvironment.RequestRecycle();
            }
        }
开发者ID:kmaclean,项目名称:lokad-cloud,代码行数:14,代码来源:ServiceFabricHost.cs

示例13: RoleEnvironmentChanging

        private static void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            int i = 1;
            foreach (var c in e.Changes)
            {
                Trace.WriteLine(string.Format("RoleEnvironmentChanging: #{0} Type={1} Change={2}", i++, c.GetType().FullName, c));
            }

            // If a configuration setting is changing);
            if (e.Changes.Any((RoleEnvironmentChange change) => change is RoleEnvironmentConfigurationSettingChange))
            {
                // Set e.Cancel to true to restart this role instance
                e.Cancel = true;
            }
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:15,代码来源:WorkerRole.cs

示例14: RoleEnvironment_Changing

        void RoleEnvironment_Changing(object sender, RoleEnvironmentChangingEventArgs e)
        {
            Trace.TraceInformation("Change notification");

            if (e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()
                .Any(c => !string.Equals(c.ConfigurationSettingName, MvcApplication.AzureLoggingVerbositySettingName, StringComparison.Ordinal)))
            {
                Trace.TraceInformation("Cancelling instance");
                e.Cancel = true;
            }
            else
            {
                Trace.TraceInformation("Handling change without recycle");
            }
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:15,代码来源:WebRole.cs

示例15: OnChanging

 private void OnChanging(object sender, RoleEnvironmentChangingEventArgs e)
 {
     foreach (var change in e.Changes)
     {
         var configChange = change as RoleEnvironmentConfigurationSettingChange;
         if (configChange != null)
         {
             if (configChange.ConfigurationSettingName == "DatabaseConnectionString")
             {
                 // Our database connectionstring changed.
                 // Maybe we need to restart the instance to make sure our cached objects no longer use the previous value.
                 e.Cancel = true;
             }
         }
     }
 }
开发者ID:justazure,项目名称:JustAzure.CloudServices,代码行数:16,代码来源:WebRole.cs


注:本文中的RoleEnvironmentChangingEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。