zoukankan
html css js c++ java
在B/S系统中引入定时器的功能
现在在ASP。NET中可以使用自定义实现IHttpModule接口的类来加载一个定时器。
public
class
OilIHttpModule : IHttpModule
{
public
static
Timer analyseTimer;
//
分析数据的定时器 static int intLastTrialInfo_id;
//
最后分析的ID static long intAnalyseInterval= 10000;
//
间隔的时间 public OilIHttpModule() { } public String ModuleName { get { return "OilModule"; } }
//
/初始化模型 public void Init(HttpApplication application) { application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
//
增加处理请求时触发的事件 if(intLastTrialInfo_id==0) {
//
获取最后分析的 trialInfo_id intLastTrialInfo_id = globalMethod.getLastAnalyseTrialInfo_id(); }
//
判断Timer是否存在,如果没有则实例化 if(analyseTimer==null) analyseTimer = new Timer(new TimerCallback(analyseData),null,intAnalyseInterval,intAnalyseInterval); }
private
void
Application_BeginRequest(Object source, EventArgs e)
{
//
null
//
HttpApplication application = (HttpApplication)source;
//
application.Response.Write(intLastTrialInfo_id.ToString()); }
//
/要定时执行的程序片段 private void analyseData(object obj) {
//
/很重要,可以防止定时器被重新生成 analyseTimer.Change( System.Threading.Timeout.Infinite, intAnalyseInterval );
//
StatsInterval int intTrialInfo_idAfterUpdate; intTrialInfo_idAfterUpdate = globalMethod.AnalyseTrialFromTrialInfo_id(intLastTrialInfo_id); if(intTrialInfo_idAfterUpdate > intLastTrialInfo_id) { intLastTrialInfo_id = intTrialInfo_idAfterUpdate; } } public void Dispose() { analyseTimer = null;
}
查看全文
相关阅读:
POJ 3268——Silver Cow Party——————【最短路、Dijkstra、反向建图】
POJ 1797 ——Heavy Transportation——————【最短路、Dijkstra、最短边最大化】
POJ 2253 ——Frogger——————【最短路、Dijkstra、最长边最小化】
HDU 5505——GT and numbers——————【素数】
int,long,long long的数据范围
HDU 5501——The Highest Mark——————【贪心+dp】
UVALive 4262——Trip Planning——————【Tarjan 求强连通分量个数】
随手记
工作流引擎资料/产品收集
Vim 学习指南
原文地址:https://www.cnblogs.com/ghd258/p/264072.html
最新文章
SSIS教程:创建简单的ETL包 -- 1. 创建项目和基本包
如何降本?
决策树学习笔记整理【转】
【机器学习】k-近邻算法以及算法实例
R语言︱情感分析—词典型代码实践(最基础)(一)
R语言做文本挖掘 Part2分词处理
电脑上有office,但不能新建word文档怎么办?
QQ左侧滑动显示
Android线程之主线程向子线程发送消息
Android线程之并发处理
热门文章
Android线程之Looper
Android切换动画之ViewPager
Android线程处理之Handler总结
Android线程处理之Handler
Android线程处理
JAVA实现Excel的读写--poi
JAVA实现Excel的读写--jxl
POJ 1860——Currency Exchange——————【最短路、SPFA判正环】
POJ 3660—— Cow Contest——————【Floyd传递闭包】
POJ 3259——Wormholes——————【最短路、SPFA、判负环】
Copyright © 2011-2022 走看看