什么是ReturnJob在IJobFactory接口的宗旨,为Quartz.Net [英] what's the purpose of ReturnJob in IJobFactory Interface for Quartz.Net

查看:1011
本文介绍了什么是ReturnJob在IJobFactory接口的宗旨,为Quartz.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用simpleInjector作为IOC容器积屑瘤

我没有什么的 ReturnJob ,我想知道我该怎么继续?

$ B $的responsabillity一个明确的说法b

这是到目前为止,我已经完成了代码:

 公共类SimpleInjectorJobFactory:IJobFactory 
{
私人只读集装箱_container;
公共SimpleInjectorJobFactory()
{
_container =新的Container();
}

公共IJob NewJob(TriggerFiredBundle捆绑,IScheduler调度)
{
返回_container.GetInstance(bundle.JobDetail.JobType)为IJob;
}

公共无效ReturnJob(IJob工作)
{
抛出新System.NotImplementedException();
}
}


解决方案

这方法允许返回实例回到IoC容器和放大器;作业工厂进行适当的清理。



提交在github上。


I'm using simpleInjector as IOC container bue I dont have a clear view of what's the responsabillity of ReturnJob, I'd like to know how can I proceed?

this is the code I have done so far:

public class SimpleInjectorJobFactory:IJobFactory
    {
        private readonly Container _container;
        public SimpleInjectorJobFactory()
        {
            _container= new Container();
        }

        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            return _container.GetInstance(bundle.JobDetail.JobType) as IJob;
        }

        public void ReturnJob(IJob job)
        {
            throw new System.NotImplementedException();
        }
    }

解决方案

This method allow returning the instance back to IoC container & Job factory for proper cleanup.

Check this commit on github.

这篇关于什么是ReturnJob在IJobFactory接口的宗旨,为Quartz.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆