| 12345678910111213141516171819202122232425262728293031323334353637 |
- using Castle.DynamicProxy;
- namespace SHJX.Service.Control.Proxy
- {
- public class AopInterceptor : IInterceptor
- {
- private static readonly ILogger logger = LogFactory.BuildLogger(typeof(AopInterceptor));
- private static IDataManager _dataManager;
- private static ReadConfigUtil _configUtil;
- public AopInterceptor(IDataManager dataManager, ReadConfigUtil configUtil)
- {
- _dataManager = dataManager;
- _configUtil = configUtil;
- }
- public void Intercept(IInvocation invocation)
- {
- try
- {
- if (!_configUtil.TaskRunning)
- {
- logger.LogDebug("任务已暂停");
- }
- while (!_configUtil.TaskRunning)
- {
- Thread.Sleep(1 * 1000);
- }
- invocation?.Proceed();
- }
- catch (Exception ex)
- {
- logger.LogError(ex.ToString());
- }
- }
- }
- }
|