Class SchedulerManager
java.lang.Object
org.apache.pulsar.functions.worker.SchedulerManager
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSchedulerManager(org.apache.pulsar.functions.worker.WorkerConfig workerConfig, org.apache.pulsar.client.api.PulsarClient pulsarClient, org.apache.pulsar.client.admin.PulsarAdmin admin, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.Producer<byte[]>acquireExclusiveWrite(Supplier<Boolean> isLeader) Acquires a exclusive producer.voidclose()Future<?>drainIfNotInProgress(String workerId) org.apache.pulsar.client.admin.LongRunningProcessStatusgetDrainStatus(String workerId) voidinitialize(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer) Future<?>Future<?>schedule()protected int
-
Field Details
-
HEARTBEAT_TENANT
- See Also:
-
HEARTBEAT_NAMESPACE
- See Also:
-
-
Constructor Details
-
SchedulerManager
public SchedulerManager(org.apache.pulsar.functions.worker.WorkerConfig workerConfig, org.apache.pulsar.client.api.PulsarClient pulsarClient, org.apache.pulsar.client.admin.PulsarAdmin admin, WorkerStatsManager workerStatsManager, ErrorNotifier errorNotifier)
-
-
Method Details
-
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.- Parameters:
isLeader- if the worker is still the leader- Returns:
- A valid exclusive producer
- Throws:
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()- Specified by:
closein interfaceAutoCloseable
-