@@ -53,8 +53,6 @@ public sealed partial class Silo : IAsyncDisposable, IDisposable
5353 /// </summary>
5454 public Task SiloTerminated { get { return this . siloTerminatedTask . Task ; } } // one event for all types of termination (shutdown, stop and fast kill).
5555
56- private LifecycleSchedulingSystemTarget lifecycleSchedulingSystemTarget ;
57-
5856 /// <summary>
5957 /// Initializes a new instance of the <see cref="Silo"/> class.
6058 /// </summary>
@@ -142,12 +140,9 @@ public Silo(ILocalSiloDetails siloDetails, IServiceProvider services)
142140 /// <returns>A <see cref="Task"/> representing the operation.</returns>
143141 public async Task StartAsync ( CancellationToken cancellationToken )
144142 {
145- // SystemTarget for provider init calls
146- this . lifecycleSchedulingSystemTarget = Services . GetRequiredService < LifecycleSchedulingSystemTarget > ( ) ;
147-
148143 try
149144 {
150- await this . lifecycleSchedulingSystemTarget . WorkItemGroup . QueueTask ( ( ) => this . siloLifecycle . OnStart ( cancellationToken ) , lifecycleSchedulingSystemTarget ) ;
145+ await Task . Run ( ( ) => this . siloLifecycle . OnStart ( cancellationToken ) , cancellationToken ) ;
151146 }
152147 catch ( Exception exc )
153148 {
@@ -344,7 +339,7 @@ public async Task StopAsync(CancellationToken cancellationToken)
344339
345340 try
346341 {
347- await this . lifecycleSchedulingSystemTarget . QueueTask ( ( ) => this . siloLifecycle . OnStop ( cancellationToken ) ) . ConfigureAwait ( false ) ;
342+ await Task . Run ( ( ) => this . siloLifecycle . OnStop ( cancellationToken ) , cancellationToken ) . ConfigureAwait ( false ) ;
348343 }
349344 finally
350345 {
@@ -427,8 +422,7 @@ private async Task OnActiveStop(CancellationToken ct)
427422 {
428423 try
429424 {
430- await lifecycleSchedulingSystemTarget
431- . QueueTask ( ( ) => this . messageCenter . Gateway . SendStopSendMessages ( this . grainFactory ) ) . WaitAsync ( ct ) ;
425+ await Task . Run ( ( ) => this . messageCenter . Gateway . SendStopSendMessages ( this . grainFactory ) , ct ) . WaitAsync ( ct ) ;
432426 }
433427 catch ( Exception exception )
434428 {
@@ -679,14 +673,4 @@ private readonly struct SiloAddressConsistentHashCodeLogValue(SiloAddress siloAd
679673 ) ]
680674 private static partial void LogDebugGrainServiceStopped ( ILogger logger , string grainServiceType , GrainId grainServiceId ) ;
681675 }
682-
683- // A dummy system target for fallback scheduler
684- internal sealed class LifecycleSchedulingSystemTarget : SystemTarget
685- {
686- public LifecycleSchedulingSystemTarget ( SystemTargetShared shared )
687- : base ( Constants . LifecycleSchedulingSystemTargetType , shared )
688- {
689- shared . ActivationDirectory . RecordNewTarget ( this ) ;
690- }
691- }
692676}
0 commit comments