类 SchedulerManager
java.lang.Object
org.apache.pulsar.functions.worker.SchedulerManager
- 所有已实现的接口:
AutoCloseable
The scheduler manager is used to compute scheduling of function instances
Only the leader computes new schedulings and writes assignments to the assignment topic
The lifecyle of this class is the following:
1. When worker becomes leader, this class with be initialized
2. When worker loses leadership, this class will be closed which
also closes the worker's producer to the assignments topic
-
嵌套类概要
嵌套类修饰符和类型类说明static classstatic classstatic classstatic classstatic class -
字段概要
字段 -
构造器概要
构造器构造器说明SchedulerManager(WorkerConfig workerConfig, org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarAdmin admin, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier) -
方法概要
修饰符和类型方法说明org.apache.pulsar.client.api.Producer<byte[]>acquireExclusiveWrite(Supplier<Boolean> isLeader) Acquires a exclusive producer.voidclose()Future<?>drainIfNotInProgress(String workerId) getDrainStatus(String workerId) voidinitialize(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer) Future<?>Future<?>schedule()protected int
-
字段详细资料
-
构造器详细资料
-
SchedulerManager
public SchedulerManager(WorkerConfig workerConfig, org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarAdmin admin, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier)
-
-
方法详细资料
-
acquireExclusiveWrite
public org.apache.pulsar.client.api.Producer<byte[]> acquireExclusiveWrite(Supplier<Boolean> isLeader) throws WorkerUtils.NotLeaderAnymore Acquires a exclusive producer. This method cannot return null. It can only return a valid exclusive producer or throw NotLeaderAnymore exception.- 参数:
isLeader- if the worker is still the leader- 返回:
- A valid exclusive producer
- 抛出:
WorkerUtils.NotLeaderAnymore- if the worker is no longer the leader.
-
initialize
public void initialize(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer) -
schedule
-
rebalanceIfNotInprogress
-
drainIfNotInProgress
-
getDrainStatus
-
updateWorkerDrainMap
protected int updateWorkerDrainMap() -
close
public void close()- 指定者:
close在接口中AutoCloseable
-