الطوابير الحاجبة والمنتج والمستهلك
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
build a bounded pipeline with backpressure.
الموضوعات المخطط لها
BlockingQueue:putblocks when full,takeblocks when empty;offer/pollaccept timeouts.ArrayBlockingQueueis bounded;LinkedBlockingQueueis unbounded unless given a capacity.- A bounded queue gives backpressure: fast producers slow down instead of exhausting memory.
- Stopping consumers: send a poison pill, or interrupt the workers.
- Choose queue size from latency tolerance, not "large to be safe".
تفاصيل المخطط المبدئي
عرض عملي
BlockingQueue<OrderEvent> q = new ArrayBlockingQueue<>(1_000);
// producer: q.put(event); consumer: var e = q.take();اختبر فهمك
What happens when a producer calls put on a full queue?
أظهر الإجابة
It blocks until space is free.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.