@Override
    public void run() {
        
        try{
            Random rnd=new Random();
            while(true)
            {
                Integer item=scheduledQueue.retrieveItem();
                if(item==null){
                    //There is nothing to consume , producer is too slow or even dead
                    if(!isAnyProducerAlive()){
                        break;// there is no alive producers
                    }
                }else{
                    //We consume successfully an item
                    totalConsumedItemsCounter++;
                    System.out.println("Consumer ["+name+"] consumed <<< '"+item+"'");
          
                }
                Thread.sleep(rnd.nextInt(50));
            }
        }catch(InterruptedException e){
            System.out.println("Consumer process "+name+" is killed");
        }
        //Print statistics
        System.out.println("Number of items consumed by process "+name+" is # "+totalConsumedItemsCounter);
    }