📄 recverstaticinfo.java
字号:
/*
* Created on 2005-8-14
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.rainbow.mms.gateway;
import java.util.TimerTask;
import org.apache.log4j.Logger;
/**
* 统计接收到的消息
* @author Rainbow MMS Group Leader —— TrWorks
*
*/
class RecverStaticInfo extends TimerTask {
private int deliverNum;
private int reportNum;
private int readNum;
private static RecverStaticInfo INSTANCE = new RecverStaticInfo();
private Logger log = Logger.getLogger(RecverStaticInfo.class);
private RecverStaticInfo(){
}
public static RecverStaticInfo getInstance(){
return INSTANCE;
}
/**
* @return Returns the deliverNum.
*/
public synchronized final int getDeliverNum() {
return deliverNum;
}
public synchronized final void addDeliverNum() {
this.deliverNum++;
}
/**
* @return Returns the readNum.
*/
public synchronized final int getReadNum() {
return readNum;
}
public synchronized final void addReadNum() {
this.readNum++;
}
/**
* @return Returns the reportNum.
*/
public synchronized final int getReportNum() {
return reportNum;
}
public synchronized final void addReportNum() {
this.reportNum++;
}
public synchronized String toString(){
StringBuffer buffer = new StringBuffer();
buffer.append("\n收到的Deliver的数量: " + getDeliverNum() + "\n");
buffer.append("收到的Report的数量: " + getReportNum() + "\n");
buffer.append("收到的Read的数量: " + getReadNum() + "\n");
return buffer.toString();
}
/* (non-Javadoc)
* @see java.util.TimerTask#run()
*/
public void run() {
// TODO Auto-generated method stub
log.info(this.toString());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -