You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal aligns IGrainTimer more closely with Timer from the BCL, granting users a couple of useful additions:
Grain timer dueTime and period can be changed after the timer has been created.
Grain timer can be disposed asynchronously - the disposal task completes after any pending callback complete.
namespace Orleans.Runtime;// New type, similar to ITimerpublicinterfaceIGrainTimer:IDisposable,IAsyncDisposable{voidChange(TimeSpandueTime,TimeSpanperiod);}// Update return type from IDisposable to IGrainTimer:publicinterfaceITimerRegistry{
IGrainTimer RegisterTimer(IGrainContextgrainContext,Func<object?,Task>asyncCallback,object?state,TimeSpandueTime,TimeSpanperiod);}publicabstractclassGrain:IGrainBase,IAddressable{// ...protected IGrainTimer RegisterTimer(Func<object?,Task>asyncCallback,object?state,TimeSpandueTime,TimeSpanperiod)// ...}
To implement the proposal, we will need to do the following:
Make IGrainTimer public
Update IGrainTimer to match the Change(dueTime, period) style of ITimer from the BCL
Update RegisterTimer methods to return IGrainTimer instead of just IDisposable
Internally, rewrite GrainTimer, which is the class which implements IGrainTimer to support this functionality, and update consumers to accommodate.
The text was updated successfully, but these errors were encountered:
This proposal aligns
IGrainTimer
more closely withTimer
from the BCL, granting users a couple of useful additions:dueTime
andperiod
can be changed after the timer has been created.To implement the proposal, we will need to do the following:
IGrainTimer
publicIGrainTimer
to match theChange(dueTime, period)
style ofITimer
from the BCLRegisterTimer
methods to returnIGrainTimer
instead of justIDisposable
GrainTimer
, which is the class which implementsIGrainTimer
to support this functionality, and update consumers to accommodate.The text was updated successfully, but these errors were encountered: