本文整理汇总了C#中GlobalConfiguration.OnConfigChange方法的典型用法代码示例。如果您正苦于以下问题:C# GlobalConfiguration.OnConfigChange方法的具体用法?C# GlobalConfiguration.OnConfigChange怎么用?C# GlobalConfiguration.OnConfigChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalConfiguration
的用法示例。
在下文中一共展示了GlobalConfiguration.OnConfigChange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Catalog
internal Catalog(
GrainId grainId,
SiloAddress silo,
string siloName,
ILocalGrainDirectory grainDirectory,
GrainTypeManager typeManager,
OrleansTaskScheduler scheduler,
ActivationDirectory activationDirectory,
ClusterConfiguration config,
IGrainRuntime grainRuntime,
out Action<Dispatcher> setDispatcher)
: base(grainId, silo)
{
LocalSilo = silo;
localSiloName = siloName;
directory = grainDirectory;
activations = activationDirectory;
this.scheduler = scheduler;
GrainTypeManager = typeManager;
this.grainRuntime = grainRuntime;
collectionNumber = 0;
destroyActivationsNumber = 0;
logger = TraceLogger.GetLogger("Catalog", TraceLogger.LoggerType.Runtime);
this.config = config.Globals;
setDispatcher = d => dispatcher = d;
ActivationCollector = new ActivationCollector(config);
GC.GetTotalMemory(true); // need to call once w/true to ensure false returns OK value
config.OnConfigChange("Globals/Activation", () => scheduler.RunOrQueueAction(Start, SchedulingContext), false);
IntValueStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_COUNT, () => activations.Count);
activationsCreated = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_CREATED);
activationsDestroyed = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_DESTROYED);
activationsFailedToActivate = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_FAILED_TO_ACTIVATE);
collectionCounter = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_COLLECTION_NUMBER_OF_COLLECTIONS);
inProcessRequests = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGING_PROCESSING_ACTIVATION_DATA_ALL, () =>
{
long counter = 0;
lock (activations)
{
foreach (var activation in activations)
{
ActivationData data = activation.Value;
counter += data.GetRequestCount();
}
}
return counter;
});
}
示例2: Catalog
public Catalog(
SiloInitializationParameters siloInitializationParameters,
ILocalGrainDirectory grainDirectory,
GrainTypeManager typeManager,
OrleansTaskScheduler scheduler,
ActivationDirectory activationDirectory,
ClusterConfiguration config,
GrainCreator grainCreator,
NodeConfiguration nodeConfig,
ISiloMessageCenter messageCenter,
PlacementDirectorsManager placementDirectorsManager)
: base(Constants.CatalogId, messageCenter.MyAddress)
{
LocalSilo = siloInitializationParameters.SiloAddress;
localSiloName = siloInitializationParameters.Name;
directory = grainDirectory;
activations = activationDirectory;
this.scheduler = scheduler;
GrainTypeManager = typeManager;
collectionNumber = 0;
destroyActivationsNumber = 0;
this.grainCreator = grainCreator;
this.nodeConfig = nodeConfig;
logger = LogManager.GetLogger("Catalog", Runtime.LoggerType.Runtime);
this.config = config.Globals;
ActivationCollector = new ActivationCollector(config);
this.Dispatcher = new Dispatcher(scheduler, messageCenter, this, config, placementDirectorsManager);
GC.GetTotalMemory(true); // need to call once w/true to ensure false returns OK value
config.OnConfigChange("Globals/Activation", () => scheduler.RunOrQueueAction(Start, SchedulingContext), false);
IntValueStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_COUNT, () => activations.Count);
activationsCreated = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_CREATED);
activationsDestroyed = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_DESTROYED);
activationsFailedToActivate = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_FAILED_TO_ACTIVATE);
collectionCounter = CounterStatistic.FindOrCreate(StatisticNames.CATALOG_ACTIVATION_COLLECTION_NUMBER_OF_COLLECTIONS);
inProcessRequests = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGING_PROCESSING_ACTIVATION_DATA_ALL, () =>
{
long counter = 0;
lock (activations)
{
foreach (var activation in activations)
{
ActivationData data = activation.Value;
counter += data.GetRequestCount();
}
}
return counter;
});
maxWarningRequestProcessingTime = this.config.ResponseTimeout.Multiply(5);
maxRequestProcessingTime = this.config.MaxRequestProcessingTime;
}