清楚缓冲

xuancao 2005-05-25 03:57:52
<%
response.setHeader("Cache-Control", "no-store");
response.setHeader("pragma", "no-cache");
%>
...全文
67 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuancao 2005-08-05
  • 打赏
  • 举报
回复

package com.carry.ictrade.dataimport.dao;

/**
* <p>Title: 数据导入JAVABEAN</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: GuangDong GEVER TECH CO.LTD</p>
* Created on 2005-8-5
* @author dalily
* @version 1.0
*/
import java.io.Serializable;



public class DataImportTaskBean implements Runnable, Serializable {
private int counter;
private int sum;
private boolean started;
private boolean running;
private int sleep;
private String filepath ;
private String autoId ;
private DataImportDAO dao ;

public DataImportTaskBean() {
counter = 0;
sum = 0;
started = false;
running = false;
sleep = 1;
dao = DataImportFactory.getInstance().getExlToDB2DAO();
}

protected void work() {
try {
Thread.sleep(sleep);
dao.importData(getFilepath(),getAutoId());
} catch (InterruptedException e) {
setRunning(false);
}
}

public synchronized int getPercent() {
return counter;
}

public synchronized boolean isStarted() {
return started;
}

public synchronized boolean isCompleted() {
return counter == 100;
}


public synchronized boolean isRunning() {
return running;
}

public synchronized void setRunning(boolean running) {
this.running = running;
if (running)
started = true;
}

public synchronized Object getResult() {
dao.getRowCout();

/*
if (isCompleted())
return new Integer(sum);
else
return null;
*/
}

public void run() {
try {
setRunning(true);
while (isRunning() && !isCompleted())
work();
} finally {
setRunning(false);
}
}

/**
* @param autoId The autoId to set.
*/
public void setAutoId(String autoId) {
this.autoId = autoId;
}

/**
* @return Returns the autoId.
*/
public String getAutoId() {
return autoId;
}

/**
* @param filepath The filepath to set.
*/
public void setFilepath(String filepath) {
this.filepath = filepath;
}

/**
* @return Returns the filepath.
*/
public String getFilepath() {
return filepath;
}
}
xuancao 2005-08-05
  • 打赏
  • 举报
回复
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: GuangDong GEVER GEVER TECH CO.LTD</p>
* @author 李冉冉
* Created on 2005-8-3
* @version 1.0
*/
package com.carry.ictrade.dataimport.dao;

import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.carry.ictrade.exception.DAOException;


public interface DataImportDAO {

/**
* 将数据从Excel表中导入DB2表中
* @param request
* @return true:导入成功
* false:导入不成功
* @throws DAOException
* @throws SQLException
*/
public boolean importData (String path, String autoId) ;

/**
* 获需要导入的记录数--总的记录数
* @return
*/
public long getTotalCout() ;

/**
*
* @return
*/
public long getCount();



/**
* 读取Excel文档中的数据
* @return List
* @throws DAOException
*/
//public List readEXL(String path, String autoId) throws DAOException;


}
xuancao 2005-08-05
  • 打赏
  • 举报
回复
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: GuangDong GEVER GEVER TECH CO.LTD</p>
* @author 李冉冉
* Created on 2005-8-3
* @version 1.0
*/
package com.carry.ictrade.dataimport.dao;

import com.carry.ictrade.dataimport.dao.impl.DataImportFactoryImpl;


public abstract class DataImportFactory {
private static DataImportFactory instance = null;

protected DataImportFactory() {
}

public static DataImportFactory getInstance() {
if (instance == null) {
instance = new DataImportFactoryImpl();
}

return instance;
}

//获取DAO
public abstract DataImportDAO getExlToDB2DAO();
}
MARS.nEIL 2005-05-25
  • 打赏
  • 举报
回复
jf

23,405

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧