zoukankan      html  css  js  c++  java
  • 循环执行timer

    using System;
    using System.Collections.Generic;
    using System.Text;
    using APlusEmail.Quartz.EmailJob;
    using APlusEmail.Model;
    
    namespace APlusEmail.Quartz.Timer
    {
        public class TimerManager
        {
            System.Timers.Timer t = new System.Timers.Timer(10000); //实例化Timer类,设置间隔时间为10000毫秒; 
            public TimerManager()
            {
                t.Elapsed += new System.Timers.ElapsedEventHandler(theout);
                //到达时间的时候执行事件;   
                t.AutoReset = true;
                //设置是执行一次(false)还是一直执行(true);   
                t.Enabled = true;
                //是否执行System.Timers.Timer.Elapsed事件;    
    
            }
    
            APlusEmail.BLL.AP01SendRightEntity aP01SendRightEntityBLL = new APlusEmail.BLL.AP01SendRightEntity();
            SendEmailCeaseless sendEmailCeaselessTool = new SendEmailCeaseless();
            bool isRun = false;
            public void theout(object source, System.Timers.ElapsedEventArgs e)
            {
                //执行
                Console.WriteLine("fff");
                if (QueueManager.SendQueue.Count != 0)
                {
                    AP01SendQueueNew aP01SendQueue = QueueManager.GetQueueItem();
                    while (!isRun)//队列还有任务 同时没有任务执行
                    {
                        //根据aid获取发送任务
                        isRun = true;
                        AP01SendRightEntity aP01SendRightEntity = aP01SendRightEntityBLL.GetModel((int)aP01SendQueue.aid);
                        SendInfo sendInfo = sendEmailCeaselessTool.SendEmailLaunch(aP01SendRightEntity);
                        //根据sendinfo来判断
                        if (sendInfo.Info == "发完")
                        {
                            //删除该条queue
                            QueueManager.DeleteQueueItem();
    
                            //修改数据库
    
                            //修改xptable
    
                        }
                    }
                }
                
            }  
        }
    }
  • 相关阅读:
    解决undefined reference to `__poll_chk@GLIBC_2.16' 错误
    交叉编译总结 libosscore.a libcurl.a libmysqlclient.a
    APUE环境配置
    UDT中epoll对CLOSE状态的处理
    查看ld搜索路径
    linux shell 比较文件夹内容 diff
    交互式makefile
    linux shell取文本最后一行
    linux 查看静态库,动态库是32位还是64位
    python学习day4之路
  • 原文地址:https://www.cnblogs.com/maijin/p/2823630.html
Copyright © 2011-2022 走看看