
public class Producer extends Thread {

    protected Channel channel;

    private int prevTime = 0;
    
    protected Producer(Channel channel) {
        this.channel = channel;
    }

    protected void put(String data, int time) {
        try {
            int waitingTime = time - prevTime;
            prevTime = time;
            Thread.sleep(waitingTime * 1000);
        } catch (InterruptedException e) { /* empty*/ }

        System.out.println(time + " put");
        channel.put(data);
    }
}
