أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
Yes I am. I have undertaken advanced java programming. Normally, the producer / consumer design pattern is a pre-designed solution to separate the two main components by placing a queue in the middle. Normally, in Java programming, the producer and the consumer will be classes that are able to be run independently from the main java thread. Both classes will need to extend Thread or implement multiple instances (e.g. Runnable or other instances)
I would use the implementations of BlockingQueue which is thread-safe compared to other types of Queues. Other queue types that could be used are ArrayBlockingQueue, LinkedBlockingQueue and PriorityBlockingQueue.