首页 > 代码库 > Job1
Job1
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); } } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。