admin管理员组文章数量:1181872
I have a services activated in shared process model. My service base class extends StatefulService class like this:
public class MyStatefulService : StatefulService, IDisposable
{
public StatefulServiceBase(
StatefulServiceContext serviceContext,
IReliableStateManagerReplica2 reliableStateManagerReplica)
: base(serviceContext, reliableStateManagerReplica)
public void Dispose()
{
// my cleanup code
}
}
I noticed that Service Fabric never calls Dispose() method in my class. Is there a different approach for disposing/cleaning up resources?
I have a services activated in shared process model. My service base class extends StatefulService class like this:
public class MyStatefulService : StatefulService, IDisposable
{
public StatefulServiceBase(
StatefulServiceContext serviceContext,
IReliableStateManagerReplica2 reliableStateManagerReplica)
: base(serviceContext, reliableStateManagerReplica)
public void Dispose()
{
// my cleanup code
}
}
I noticed that Service Fabric never calls Dispose() method in my class. Is there a different approach for disposing/cleaning up resources?
Share Improve this question edited yesterday Peter Bons 29.7k4 gold badges62 silver badges81 bronze badges Recognized by Microsoft Azure Collective asked yesterday Slobo80Slobo80 1888 bronze badges1 Answer
Reset to default 0There is no support for IDisposable
, there is a ticket for it but it is still open.
You can override the StatefulServiceBase.OnCloseAsync()
method and cleanup there or act on the cancellation request of the cancellation token passed to RunAsync().
The full lifecycle is documented here
本文标签: cBest way to clean up resources in StatefulServiceStack Overflow
版权声明:本文标题:c# - Best way to clean up resources in StatefulService - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738176907a2067296.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论