package com.kiisoo.ic.job;

import com.lmax.disruptor.dsl.Disruptor;

import java.util.concurrent.CountDownLatch;

public class DTOMessagePublish implements Runnable {
    private Disruptor<DTOMessage> disruptor;
    private CountDownLatch latch;

    public DTOMessagePublish(Disruptor<DTOMessage> disruptor, CountDownLatch latch) {
        this.disruptor = disruptor;
        this.latch = latch;
    }

    @Override
    public void run() {
        for (int i = 0; i < 3; i++) {
            disruptor.publishEvent(new DTOMessageEventTranslator());
        }
        latch.countDown();
    }
}
