Class AssignmentDistributionService

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class AssignmentDistributionService
    extends Object
    implements Closeable
    A service for distributing master assignments to supervisors, this service makes the assignments notification asynchronous.

    We support multiple working threads to distribute assignment, every thread has a queue buffer.

    Master will shuffle its node request to the queues, if the target queue is full, we just discard the request, let the supervisors sync instead.

    Caution: this class is not thread safe.

    
     Working mode
                          +--------+         +-----------------+
                          | queue1 |   ==>   | Working thread1 |
     +--------+ shuffle   +--------+         +-----------------+
     | Master |   ==>
     +--------+           +--------+         +-----------------+
                          | queue2 |   ==>   | Working thread2 |
                          +--------+         +-----------------+