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
RemoteException
public void reset()
public boolean isCancel()
public boolean acceptWork(Work work) throws RemoteException
acceptWork
in interface Worker
work
- RemoteException
public Warehouse work(Work work) throws RemoteException
Worker
work
in interface Worker
RemoteException
protected abstract Warehouse doWork(Work work) throws RemoteException
work
- RemoteException
public String getType()
Worker
getType
in interface ParallelObject
getType
in interface Worker
public void cancel()
public String getId()
getId
in interface ParallelObject
Copyright © 2006–2018 TinyGroup. All rights reserved.