j+a+v+a
常用鏈接
我的隨筆
我的評論
我的參與
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2007年7月 (4)
搜索
最新評論
閱讀排行榜
1.?StringtoDate的方法(949)
2.?resin+xml和tomcat+xml配置(713)
3.?啟動服務(wù)讀取XML配置文件(解析XML)(420)
4.?定時統(tǒng)計(276)
評論排行榜
1.?resin+xml和tomcat+xml配置(0)
2.?StringtoDate的方法(0)
3.?定時統(tǒng)計(0)
4.?啟動服務(wù)讀取XML配置文件(解析XML)(0)
Powered by:
博客園
模板提供:
滬江博客
BlogJava
|
首頁
|
發(fā)新隨筆
|
發(fā)新文章
|
聯(lián)系
|
聚合
|
管理
定時統(tǒng)計
/** */
/**
* 定時統(tǒng)計在線人數(shù)
*/
public
class
PreTestSelRunner
{
private
static
PreTestSel preTestSel;
/** */
/**
* 定時執(zhí)行--靜態(tài)方法(避免重復(fù)執(zhí)行)
*
@param
conn
*
@throws
Exception
*/
public
static
void
load()
throws
Exception
{
//
間隔時間設(shè)置,10分鐘
long
period
=
10
*
1000
*
60
;
PreTestSelRunner.preTestSel
=
new
PreTestSel(period);
}
/** */
/**
* 定時調(diào)用主方法
*
* PreTestSel.run()
*/
public
static
void
run()
{
try
{
TkGameBeanFactoryPlugin BeanPlugin
=
TkGameBeanFactoryPlugin.getIntance();
RuntimeSettingsPlugInBL runtimeSettingsPlugInBL
=
(RuntimeSettingsPlugInBL) BeanPlugin.getBean(
"
runtimeSettingsPlugInBL
"
);
try
{
//
增加統(tǒng)計在線人數(shù)記錄
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!!
"
);
}
}
}
/** */
/**
* 定時統(tǒng)計在線人數(shù)
*
*/
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();
}
}
發(fā)表于 2007-07-24 17:17
llrafale
閱讀(276)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
丹江口市
|
江北区
|
大埔县
|
开江县
|
托克逊县
|
宁陵县
|
温宿县
|
肥西县
|
谷城县
|
株洲县
|
天水市
|
葫芦岛市
|
南丹县
|
壶关县
|
翁牛特旗
|
原阳县
|
金门县
|
东宁县
|
文化
|
手游
|
眉山市
|
梅州市
|
冀州市
|
邯郸县
|
江油市
|
兴化市
|
河津市
|
和平县
|
阿拉善盟
|
浦县
|
葫芦岛市
|
安康市
|
阜阳市
|
南雄市
|
富裕县
|
金门县
|
南宁市
|
台中县
|
关岭
|
普陀区
|
即墨市
|