public final class Worker extends Server
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Worker.JacksonDeserializer
Custom deserialize Worker based jackson.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Worker |
current() |
static Worker |
deserialize(String text)
Deserialize from string.
|
boolean |
equals(Object o) |
String |
getGroup() |
String |
getWorkerId() |
int |
hashCode()
Extends
Object#hashCode() |
static boolean |
isCurrent(Worker worker) |
boolean |
matchesGroup(String taskGroup)
判断当前Worker的group是否匹配任务分派的Worker的group
|
static Worker |
of(Map<String,?> map) |
boolean |
sameWorker(Worker other)
判断是否同一台机器:其它属性相同但worker-id不同
Worker机器宕机重启后,Supervisor一段时间内仍缓存着旧的Worker,导致http通过ip:port派发的任务参数中Worker是旧的,但是新Worker接收该任务
|
String |
serialize()
Serialize to string
|
public int hashCode()
ServerObject#hashCode()public static Worker deserialize(String text)
text - the serialized text stringpublic String getGroup()
public String getWorkerId()
public boolean matchesGroup(String taskGroup)
taskGroup - the task grouptrue if matchedpublic boolean sameWorker(Worker other)
other - the other workertrue if same workerpublic static Worker current()
public static boolean isCurrent(Worker worker)
Copyright © 2023. All rights reserved.