55using System . Reflection ;
66using System . Runtime . CompilerServices ;
77using System . Text ;
8+ using System . Threading ;
89using System . Threading . Tasks ;
910using Microsoft . Extensions . DependencyInjection ;
1011using Microsoft . Extensions . Logging ;
1112using Microsoft . Extensions . Options ;
13+ using Orleans ;
1214using Orleans . Runtime ;
1315using Vertex . Abstractions . Actor ;
1416using Vertex . Abstractions . Event ;
@@ -103,9 +105,9 @@ protected virtual async ValueTask DependencyInjection()
103105 /// The method used to initialize is called when Grain is activated (overriding in subclasses is prohibited)
104106 /// </summary>
105107 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
106- public override async Task OnActivateAsync ( )
108+ public override async Task OnActivateAsync ( CancellationToken cancellationToken )
107109 {
108- await base . OnActivateAsync ( ) ;
110+ await base . OnActivateAsync ( cancellationToken ) ;
109111 await this . DependencyInjection ( ) ;
110112
111113 // Load snapshot
@@ -250,7 +252,7 @@ protected virtual ValueTask CreateSnapshot()
250252 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
251253 protected virtual ValueTask OnStartSaveSnapshot ( ) => ValueTask . CompletedTask ;
252254
253- public override async Task OnDeactivateAsync ( )
255+ public override async Task OnDeactivateAsync ( DeactivationReason reason , CancellationToken cancellationToken )
254256 {
255257 try
256258 {
@@ -263,6 +265,7 @@ public override async Task OnDeactivateAsync()
263265 if ( this . Logger . IsEnabled ( LogLevel . Trace ) )
264266 {
265267 this . Logger . LogTrace ( "Deactivate completed: {0}->{1}" , this . ActorType . FullName , this . Serializer . Serialize ( this . Snapshot ) ) ;
268+ this . Logger . LogTrace ( "Deactivate reason: {0}->{1}" , this . ActorType . Name , reason . Description ) ;
266269 }
267270 }
268271 catch ( Exception ex )
0 commit comments