ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل مستخدم محذوف‎
تاريخ النشر: 2018/03/12
Paul McMahon
من قبل 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. 

المزيد من الأسئلة المماثلة