itemcount.java
来自「用来为垂直搜索引擎抓取数据的采集系统」· Java 代码 · 共 60 行
JAVA
60 行
/*
* *****************************************************
* Copyright (c) 2005 IIM Lab. All Rights Reserved.
* Created by xuehao at Dec 13, 2005
* Contact: zxuehao@mail.ustc.edu.cn
* *****************************************************
*/
package org.indigo.util;
/**
* 一个负责统计采集数据量的类。
* @author xuehao
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ItemCount
{
private static ItemCount itsInstance=new ItemCount();
private static int itsCount=0;
private ItemCount()
{
itsCount = 0;
}
/**
* 单例模式
* @return
*/
public static ItemCount getInstance()
{
return itsInstance;
}
/**
* 重置采集数量为0;
*
*/
public void resetCount()
{
itsCount =0;
}
/**
* 每采集一条数据,把采集的数据+1.
* 实现了线程同步。
*
*/
public synchronized void incCount()
{
itsCount++;
}
/**
* 获取采集的数据量。
* @return
*/
public int getCountNum()
{
return itsCount;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?