
public class Consumer extends Thread {

    protected Channel channel;

    private int prevTime = 0;

    protected Consumer(Channel channel) {
        this.channel = channel;
    }

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

        System.out.println(time + " take");
        String data = channel.take();
    }
}


