Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Are you familiar with any design patterns related to multi-threads like for example the Producer-Consumer pattern?

user-image
Question added by Deleted user
Date Posted: 2018/03/12
Paul McMahon
by Paul McMahon , Tutor , University of Wollongong

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. 

More Questions Like This