أي خيط ينفّذ مرحلتي؟
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
choose executors deliberately.
الموضوعات المخطط لها
- Without an executor, async methods use the common
ForkJoinPool, sized for CPU work. - Blocking I/O in the common pool starves everything else that uses it, including parallel streams.
- Pass a dedicated executor for blocking calls:
supplyAsync(task, ioPool). - Non-
Asyncmethods (thenApply) run on whichever thread completes the previous stage (or the caller if already complete);thenApplyAsynchops to a pool. - Never call
join()inside a stage on a pool that may be exhausted.
تفاصيل المخطط المبدئي
عرض عملي
a diagram: HTTP calls on an ioPool; light mapping stays on the completing thread.
اختبر فهمك
Why avoid blocking I/O on the common pool?
أظهر الإجابة
It is small and shared; blocking starves other work.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.