private Task OnRuntimeInitializeStart(CancellationToken tc) { var stopWatch = Stopwatch.StartNew(); this.serializationManager = this.ServiceProvider.GetRequiredService <SerializationManager>(); this.sharedCallbackData = new SharedCallbackData( msg => this.Dispatcher.TryResendMessage(msg), msg => this.UnregisterCallback(msg.Id), this.loggerFactory.CreateLogger <CallbackData>(), this.messagingOptions, this.serializationManager, this.appRequestStatistics); var timerLogger = this.loggerFactory.CreateLogger <SafeTimer>(); var minTicks = Math.Min(this.messagingOptions.ResponseTimeout.Ticks, TimeSpan.FromSeconds(1).Ticks); var period = TimeSpan.FromTicks(minTicks); this.callbackTimer = new SafeTimer(timerLogger, this.OnCallbackExpiryTick, null, period, period); this.disposables.Add(this.callbackTimer); typeManager.Start(); stopWatch.Stop(); this.logger.Info(ErrorCode.SiloStartPerfMeasure, $"Start InsideRuntimeClient took {stopWatch.ElapsedMilliseconds} Milliseconds"); return(Task.CompletedTask); }
public CallbackData( SharedCallbackData shared, IResponseCompletionSource ctx, Message msg) { this.shared = shared; this.context = ctx; this.Message = msg; this.stopwatch = CoarseStopwatch.StartNew(); }
public CallbackData( SharedCallbackData shared, TaskCompletionSource <object> ctx, Message msg) { this.shared = shared; this.context = ctx; this.Message = msg; this.TransactionInfo = TransactionContext.GetTransactionInfo(); this.stopwatch = ValueStopwatch.StartNew(); }
public InsideRuntimeClient( ILocalSiloDetails siloDetails, GrainTypeManager typeManager, TypeMetadataCache typeMetadataCache, OrleansTaskScheduler scheduler, IServiceProvider serviceProvider, MessageFactory messageFactory, ITransactionAgent transactionAgent, ILoggerFactory loggerFactory, IOptions <SiloMessagingOptions> messagingOptions, IGrainCancellationTokenRuntime cancellationTokenRuntime, IOptions <SchedulingOptions> schedulerOptions, ApplicationRequestsStatisticsGroup appRequestStatistics, MessagingTrace messagingTrace) { this.ServiceProvider = serviceProvider; this.MySilo = siloDetails.SiloAddress; this.disposables = new List <IDisposable>(); this.callbacks = new ConcurrentDictionary <CorrelationId, CallbackData>(); this.typeManager = typeManager; this.messageFactory = messageFactory; this.transactionAgent = transactionAgent; this.Scheduler = scheduler; this.ConcreteGrainFactory = new GrainFactory(this, typeMetadataCache); this.logger = loggerFactory.CreateLogger <InsideRuntimeClient>(); this.invokeExceptionLogger = loggerFactory.CreateLogger($"{typeof(Grain).FullName}.InvokeException"); this.loggerFactory = loggerFactory; this.messagingOptions = messagingOptions.Value; this.cancellationTokenRuntime = cancellationTokenRuntime; this.appRequestStatistics = appRequestStatistics; this.messagingTrace = messagingTrace; this.schedulingOptions = schedulerOptions.Value; this.sharedCallbackData = new SharedCallbackData( msg => this.UnregisterCallback(msg.Id), this.loggerFactory.CreateLogger <CallbackData>(), this.messagingOptions, this.appRequestStatistics, this.messagingOptions.ResponseTimeout); this.systemSharedCallbackData = new SharedCallbackData( msg => this.UnregisterCallback(msg.Id), this.loggerFactory.CreateLogger <CallbackData>(), this.messagingOptions, this.appRequestStatistics, this.messagingOptions.SystemResponseTimeout); }
public InsideRuntimeClient( ILocalSiloDetails siloDetails, OrleansTaskScheduler scheduler, IServiceProvider serviceProvider, MessageFactory messageFactory, ITransactionAgent transactionAgent, ILoggerFactory loggerFactory, IOptions <SiloMessagingOptions> messagingOptions, ApplicationRequestsStatisticsGroup appRequestStatistics, MessagingTrace messagingTrace, GrainReferenceActivator referenceActivator, GrainInterfaceTypeResolver interfaceIdResolver, GrainInterfaceTypeToGrainTypeResolver interfaceToTypeResolver, ImrGrainMethodInvokerProvider invokers) { this.ServiceProvider = serviceProvider; this.MySilo = siloDetails.SiloAddress; this.disposables = new List <IDisposable>(); this.callbacks = new ConcurrentDictionary <CorrelationId, CallbackData>(); this.messageFactory = messageFactory; this.transactionAgent = transactionAgent; this.Scheduler = scheduler; this.ConcreteGrainFactory = new GrainFactory(this, referenceActivator, interfaceIdResolver, interfaceToTypeResolver, invokers); this.logger = loggerFactory.CreateLogger <InsideRuntimeClient>(); this.invokeExceptionLogger = loggerFactory.CreateLogger($"{typeof(Grain).FullName}.InvokeException"); this.loggerFactory = loggerFactory; this.messagingOptions = messagingOptions.Value; this.appRequestStatistics = appRequestStatistics; this.messagingTrace = messagingTrace; this.invokers = invokers; this.sharedCallbackData = new SharedCallbackData( msg => this.UnregisterCallback(msg.Id), this.loggerFactory.CreateLogger <CallbackData>(), this.messagingOptions, this.appRequestStatistics, this.messagingOptions.ResponseTimeout); this.systemSharedCallbackData = new SharedCallbackData( msg => this.UnregisterCallback(msg.Id), this.loggerFactory.CreateLogger <CallbackData>(), this.messagingOptions, this.appRequestStatistics, this.messagingOptions.SystemResponseTimeout); }