public class Consumer extends Thread{
   // A konstruktorban kap egy f Fifot, egy s Stringet és egy n intet
    private Fifo fifo;
    private String name;
    private int sleepTime;

    public Consumer(Fifo f, String s, int n){
        sleepTime = n;
        name = s;
        fifo = f;

        start();
    }

    @Override
    public void run() {
        try {
            while (true) {
                Thread.sleep(sleepTime);
                String curS = fifo.get();
                String systemTime = String.valueOf(System.currentTimeMillis());
                systemTime = systemTime.substring(systemTime.length() - 5);

                System.out.println("consumed "+name+" "+curS+" "+systemTime);
            }
        } catch (InterruptedException e) {
            System.out.println(name + " megszakítva");
        }
    }
}
