The Priority Job Scheduler is a console application in Java designed to manage and dispatch tasks based on their effective priority.
Its core feature is a custom implementation of a 3-ary Max Heap, demonstrating strong understanding of data structures, OOP principles, and exception handling.
-
Polymorphic Task Management:
IncludesBugFixandFeatureRequestclasses inheriting from an abstractTaskbase class. -
Dynamic Prioritization:
BugFixtasks automatically get a priority boost, ensuring that critical issues are handled before lower-impact tasks. -
Queue Operations:
PEEK– preview the next task without removing itPOP– complete and remove the highest-priority task
-
Custom Exceptions:
IncludesInvalidTaskDataExceptionandEmptyQueueExceptionfor clean error control flow.
Standard heaps are typically binary (2 children per node). This project implements a 3-ary Heap (d-ary heap where d=3), which offers specific performance trade-offs and structural differences.
In a 3-ary heap, the tree is flatter than a binary heap because each node can hold up to 3 children. This reduces the height of the tree (
Since the heap is implemented using a flat array, we use specific formulas to navigate relations between nodes:
| Relation | Formula (for index i) |
|---|---|
| Parent | (i - 1) / 3 |
| Child 1 | 3 * i + 1 |
| Child 2 | 3 * i + 2 |
| Child 3 | 3 * i + 3 |
- ✅ Faster Insertions (Push): Due to the lower tree height, "bubbling up" a new element requires fewer comparisons.
⚠️ Slower Deletions (Pop): "Bubbling down" is slightly more complex, as the algorithm must compare 3 children (instead of 2) to find the largest one to swap with.
- Language: Java 17+
- Build Tool: Apache Maven
- Testing: JUnit 5 (Jupiter)
- Data Structure: Custom 3-ary Max Heap implementation
This project follows standard Maven directory layout:
PriorityJobScheduler/
├── pom.xml # Maven configuration
└── src/
├── main/
│ └── java/
│ ├── app/ # Main console application
│ ├── logic/ # Scheduler logic (wrapper around the heap)
│ ├── model/ # Task, BugFix, FeatureRequest
│ ├── exceptions/ # Custom exceptions
│ └── structures/ # MaxHeap interface & Array3Heap implementation
└── test/
└── java/
└── tests/ # JUnit 5 tests (SchedulerTest.java)This project uses Maven for building and dependency management.
Make sure you have installed:
- Java JDK 17 or later
- Apache Maven
Check installation with:mvn -v
Open a terminal in the project root directory (where pom.xml is located) and run:
mvn clean installThis will: -Clean previous builds -Compile the project -Run all unit tests
After building, run the console application using:
java -cp target/priority-scheduler-1.0-SNAPSHOT.jar app.ConsoleAppAll major functionality—including scheduler logic and the custom heap—is covered with JUnit 5 tests. Run tests with:
mvn test