System.out.printf("Main: Buffer: Consumer count: %d\n",buffer.getWaitingConsumerCount());
/*
* Transfer an event to the consumer
*/
Event myEvent=new Event("Core Event",0);
buffer.transfer(myEvent);
System.out.printf("Main: My Event has ben transfered.\n");
/*
* Wait for the finalization of the producers
*/
for (int i=0; i<producerThreads.length; i++) {
producerThreads[i].join();
}
/*
* Sleep the thread for one second
*/
TimeUnit.SECONDS.sleep(1);
/*
* Write the actual consumer count
*/
System.out.printf("Main: Buffer: Consumer count: %d\n",buffer.getWaitingConsumerCount());
/*
* Transfer another event
*/
myEvent=new Event("Core Event 2",0);
buffer.transfer(myEvent);
/*
* Wait for the finalization of the consumer
*/