Initial_commit_SecMPS_v2
This commit is contained in:
28
api_sqlsugar/VolPro.Core/Quartz/IOCJobFactory.cs
Normal file
28
api_sqlsugar/VolPro.Core/Quartz/IOCJobFactory.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Quartz;
|
||||
using Quartz.Spi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VolPro.Core.Quartz
|
||||
{
|
||||
public class IOCJobFactory: IJobFactory
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
public IOCJobFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
|
||||
{
|
||||
return _serviceProvider.GetService(bundle.JobDetail.JobType) as IJob;
|
||||
|
||||
}
|
||||
|
||||
public void ReturnJob(IJob job)
|
||||
{
|
||||
(job as IDisposable)?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user