Class SchedulerManager
- java.lang.Object
-
- org.apache.pulsar.functions.worker.SchedulerManager
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class SchedulerManager extends java.lang.Object implements java.lang.AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchedulerManager.RebalanceInProgressException
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHEARTBEAT_NAMESPACEstatic java.lang.StringHEARTBEAT_TENANT
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.pulsar.client.api.Producer<byte[]>acquireExclusiveWrite(java.util.function.Supplier<java.lang.Boolean> isLeader)Acquires a exclusive producer.voidclose()voidinitialize(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer)java.util.concurrent.Future<?>rebalanceIfNotInprogress()java.util.concurrent.Future<?>schedule()
-
-
-
Field Detail
-
HEARTBEAT_TENANT
public static final java.lang.String HEARTBEAT_TENANT
- See Also:
- Constant Field Values
-
HEARTBEAT_NAMESPACE
public static final java.lang.String HEARTBEAT_NAMESPACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
acquireExclusiveWrite
public org.apache.pulsar.client.api.Producer<byte[]> acquireExclusiveWrite(java.util.function.Supplier<java.lang.Boolean> isLeader) throws WorkerUtils.NotLeaderAnymoreAcquires 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
public java.util.concurrent.Future<?> schedule()
-
rebalanceIfNotInprogress
public java.util.concurrent.Future<?> rebalanceIfNotInprogress()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-