Class ObjectQueueProcessor

  • public class ObjectQueueProcessor
    extends Object
    Objects for persisting would coming one by one and we do not want to persist them one by one. But we also do not know how many objects would come. So the algorithm is: when the object(s) is coming, we add them to the queue. Then, if there are no in-progress tasks persisting data, we get all the tasks from the queue and persist them. Otherwise we do not do anything.