public abstract class AbstractWorker extends Object implements Worker
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
cancel |
WORKER_TYPE| Constructor and Description |
|---|
AbstractWorker(String type) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptWork(Work work)
默认全部接受
|
void |
cancel() |
protected abstract Warehouse |
doWork(Work work)
真正的工作处理,在这里,如果提供取消工作需要对isCancel()的值进行判断,
如果是true的时候,表示要停止处理,这个时候要立即返回
|
String |
getId() |
String |
getType()
返回类型
|
boolean |
isCancel() |
void |
reset() |
Warehouse |
work(Work work)
执行工作
|
public AbstractWorker(String type) throws RemoteException
RemoteExceptionpublic void reset()
public boolean isCancel()
public boolean acceptWork(Work work) throws RemoteException
acceptWork in interface Workerwork - RemoteExceptionpublic Warehouse work(Work work) throws RemoteException
Workerwork in interface WorkerRemoteExceptionprotected abstract Warehouse doWork(Work work) throws RemoteException
work - RemoteExceptionpublic String getType()
WorkergetType in interface ParallelObjectgetType in interface Workerpublic void cancel()
public String getId()
getId in interface ParallelObjectCopyright © 2006–2018 TinyGroup. All rights reserved.