public abstract class WebProgressThread extends SucangThread
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
errMsg |
protected int |
failedCount |
protected int |
status
当前处理的状态: 0表示正在在进行中,2表示完成,-1表示手动停止提交结束
|
protected int |
sucessCount |
protected int |
totalRecord |
logger
Constructor and Description |
---|
WebProgressThread() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
表示手动中止处理,停止状态: status=-1;
|
protected void |
complete()
表示当前处理完成: status=2;
|
net.sf.json.JSONObject |
getProcessInfo()
返回值有:threadid,total,status,sucessCount,failedCount,result
如果total==0表示等待状态无百分比,否则百分比是:sucessCount+failedCount/total 如果status:0 - 表示正在进行中,-1 - 表示停止,2 - 表示完成 处理过程中的显示信息保存在result字段中 |
net.sf.json.JSONObject |
getProcessStartup()
用于初始化时调用,这时候的总和记录数可能还未获取
|
boolean |
isAbort()
表示是否被手动中止
|
boolean |
isFinish()
表示是否完成
|
abstract void |
run()
1,第一行需要调用方法initThreadLocalEnv();完成用户上下文环境初始化
2,在循环处理中根据isAbort()来决定是否跳出循环并对successCount和failedCount进行设置 3,最后一行或者直接return直接返回前必须调用complete()方法,表示已处理完成。 |
initThreadLocalEnv
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected volatile int totalRecord
protected volatile int sucessCount
protected volatile int failedCount
protected volatile java.lang.String errMsg
protected volatile int status
public abstract void run()
run
in interface java.lang.Runnable
run
in class SucangThread
protected final void complete()
public final void abort()
public final boolean isFinish()
public final boolean isAbort()
public net.sf.json.JSONObject getProcessInfo()
public net.sf.json.JSONObject getProcessStartup()
Copyright © 2019 by Sucang.cn