j+a+v+a
常用鏈接
我的隨筆
我的評論
我的參與
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2007年7月 (4)
搜索
最新評論
閱讀排行榜
1.?StringtoDate的方法(949)
2.?resin+xml和tomcat+xml配置(713)
3.?啟動服務讀取XML配置文件(解析XML)(420)
4.?定時統計(276)
評論排行榜
1.?resin+xml和tomcat+xml配置(0)
2.?StringtoDate的方法(0)
3.?定時統計(0)
4.?啟動服務讀取XML配置文件(解析XML)(0)
Powered by:
博客園
模板提供:
滬江博客
BlogJava
|
首頁
|
發新隨筆
|
發新文章
|
聯系
|
聚合
|
管理
定時統計
/** */
/**
* 定時統計在線人數
*/
public
class
PreTestSelRunner
{
private
static
PreTestSel preTestSel;
/** */
/**
* 定時執行--靜態方法(避免重復執行)
*
@param
conn
*
@throws
Exception
*/
public
static
void
load()
throws
Exception
{
//
間隔時間設置,10分鐘
long
period
=
10
*
1000
*
60
;
PreTestSelRunner.preTestSel
=
new
PreTestSel(period);
}
/** */
/**
* 定時調用主方法
*
* PreTestSel.run()
*/
public
static
void
run()
{
try
{
TkGameBeanFactoryPlugin BeanPlugin
=
TkGameBeanFactoryPlugin.getIntance();
RuntimeSettingsPlugInBL runtimeSettingsPlugInBL
=
(RuntimeSettingsPlugInBL) BeanPlugin.getBean(
"
runtimeSettingsPlugInBL
"
);
try
{
//
增加統計在線人數記錄
List list
=
runtimeSettingsPlugInBL.getBRSsoByServer();
for
(
int
i
=
0
;i
<
list.size();i
++
)
{
Game12OnlineLog obj
=
new
Game12OnlineLog();
obj.setLogtime(
new
Date());
obj.setServerno(list.get(i).toString());
obj.setValue(Integer.parseInt(list.get(i
+
1
).toString()));
runtimeSettingsPlugIn2BL.saveOnlineLog(obj);
i
=
i
+
1
;
}
}
catch
(Exception e)
{
e.printStackTrace();
}
}
catch
(Exception ex)
{
System.out.println(
"
run() error!!
"
);
}
}
}
/** */
/**
* 定時統計在線人數
*
*/
public
class
PreTestSel
extends
TimerTask
{
private
Timer timer;
/** */
/**
*
*
@param
firstTime
*
@throws
Exception
*/
public
PreTestSel(
long
period)
throws
Exception
{
this
.timer
=
new
Timer(
true
);
this
.timer.schedule(
this
,
0
, period);
}
public
void
destroy()
{
this
.timer.cancel();
}
public
void
run()
{
PreTestSelRunner.run();
}
}
發表于 2007-07-24 17:17
llrafale
閱讀(276)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
鄂托克前旗
|
阿克
|
汾阳市
|
丁青县
|
高要市
|
阜宁县
|
陕西省
|
兴义市
|
察雅县
|
洪泽县
|
湖南省
|
三江
|
乌恰县
|
陵川县
|
巴彦县
|
湘乡市
|
台前县
|
上虞市
|
黑龙江省
|
玉门市
|
富平县
|
内黄县
|
永丰县
|
图们市
|
大兴区
|
喜德县
|
东山县
|
吉木萨尔县
|
县级市
|
蒙城县
|
葵青区
|
泗洪县
|
南岸区
|
抚顺县
|
水富县
|
高尔夫
|
卓资县
|
化州市
|
深圳市
|
平远县
|
许昌市
|