Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DispatchQueuePriority.java #1826

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GeorgCantor
Copy link

Key Optimizations

  1. Separation of Concerns
    Created a separate PriorityRunnableComparator class to handle the comparison logic. This improves readability and maintains a single responsibility principle.

  2. Improved Latch Handling
    Introduced a dedicated method awaitPauseLatch() for clarity in the beforeExecute method. This encapsulates the waiting logic and enhances readability.

  3. Interrupt Handling
    When an InterruptedException occurs in the awaitPauseLatch method, the interrupt status is restored with Thread.currentThread().interrupt(). This is crucial for proper thread interruption handling.

  4. Simplified Logic
    Used Integer.compare() for comparing priorities in the comparator. This is more concise and avoids manual subtraction.

@fwadnjar142
Copy link

#1826 (comment)

@fwadnjar142
Copy link

#1826 (تعليق)

@Torres1117
Copy link

Torres1117 commented Nov 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants