Skip to content

A lightweight Java console app that helps you schedule, sort, and manage personal events with ease.

Notifications You must be signed in to change notification settings

sectep/Event-Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event-Scheduler

This project simulates the processing of events with the highest priority using a simple event scheduling mechanism in Java. The scheduler iterates through an array of Event interfaces, prioritizing those with the highest priority. When priorities are equal, it resumes the event; otherwise, it suspends it.

Features

  • Event Creation: Create and start event threads with specified priorities.
  • Priority Scheduling: The scheduler identifies and processes the event with the highest priority.
  • Thread Management: Events can be suspended, resumed, or stopped based on their priority.

Getting Started

To run this project, ensure you have Java installed on your machine. Follow these steps:

  1. Clone the Repository:

    git clone https://github.com/yourusername/eventscheduler.git
    cd eventscheduler
  2. Project Structure: Make sure to move the Java files into the eventscheduler folder:

    eventscheduler/
    ├── Event.java
    ├── EventProcessor.java
    ├── Main.java
    └── Scheduler.java
    
  3. Compile the Code: Navigate to the eventscheduler directory and compile the Java files:

    javac *.java
  4. Run the Application: Execute the main class:

    java Main

Code Overview

  • Event.java: Defines the Event class that implements Runnable. It manages the event threads and their states (suspended, stopped).
  • EventProcessor.java: Contains the logic for processing events, simulating a task with a simple delay.
  • Scheduler.java: Responsible for scheduling events based on their priority, suspending and resuming them as necessary.
  • Main.java: The entry point of the application, where events are created and started.

Example Usage

In the Main class, you can see how to create events with different priorities:

Event[] events = {
    Event.createAndStart("Backup Database", 4),
    Event.createAndStart("User   login", 8)
};

Contributing

Feel free to fork the repository and submit pull requests for any improvements or features you would like to add.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by the need for efficient event processing in multi-threaded applications.

About

A lightweight Java console app that helps you schedule, sort, and manage personal events with ease.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages