Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Utilisateur supprimé
Date de publication: 2018/03/12
Paul McMahon
par 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