Class SchedulerManager

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class SchedulerManager
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • 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.
      void close()  
      void initialize​(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer)  
      java.util.concurrent.Future<?> rebalanceIfNotInprogress()  
      java.util.concurrent.Future<?> schedule()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.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

        public java.util.concurrent.Future<?> schedule()
      • rebalanceIfNotInprogress

        public java.util.concurrent.Future<?> rebalanceIfNotInprogress()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable