码迷,mamicode.com
首页 > 其他好文 > 详细

Job1

时间:2014-07-22 00:03:33      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   for   

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using WindowsFormsApplication3.Jobs;
using WindowsFormsApplication3.DataStorge;
using WindowsFormsApplication3.Enums;

namespace WindowsFormsApplication3.Jobs.Operation_System
{
    public class Job1:BaseJob
    {

        public Job1(CheckoutContext checkoutContext, CheckoutStep checkoutStep) : base(checkoutContext, checkoutStep) {
        
        }


        public override void Execute(object _stateInfo)
        {
            int IntNumber = (int)_stateInfo;
            int ThisThreadNumber = Thread.CurrentThread.GetHashCode();
            //指示当前线程是否属于托管线程池
            bool isThreadPool = Thread.CurrentThread.IsThreadPoolThread;
            string strTip = string.Format("请求 {0} 开始,线程哈希码为,是否为线程池线程:{1},...", ThisThreadNumber, isThreadPool.ToString());
            checkoutContext.messageList.Add(strTip);
            ReportJobStateChange(CheckoutStep.ThreadPoolTest,JobStatus.Processing);

            Thread.Sleep(4000);
            strTip = string.Format("请求执行结束!");
            checkoutContext.messageList.Add(strTip);
            ReportJobStateChange(CheckoutStep.ThreadPoolTest,JobStatus.OK);

        }
    }
    
}

Job1,布布扣,bubuko.com

Job1

标签:style   blog   color   os   io   for   

原文地址:http://www.cnblogs.com/rosizel/p/3859383.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!