Skip to content

roshankraveendrababu/gender-age-prediction

Repository files navigation

Multi Threaded movie booking system

This project is a comprehensive, multi-threaded movie ticket booking system designed to run as an interactive command-line application. It simulates a real-world booking environment where multiple users can browse movies and book seats concurrently. To ensure data integrity under high contention, the system employs an advanced ReentrantReadWriteLock mechanism, allowing for simultaneous read operations while guaranteeing exclusive access for write operations like booking.

A key feature is the autonomous background service, built with ScheduledExecutorService, that automatically handles abandoned bookings by releasing expired seat locks. The system's architecture is built on sound object-oriented principles, showcasing the Factory pattern for creating different payment strategies and the Observer pattern to decouple post-booking actions, such as sending notifications or updating analytics. This project serves as a practical demonstration of robust backend engineering concepts, including advanced concurrency, system design, and common design patterns.

Features

  • Advanced Concurrency Control: Employs a ReentrantReadWriteLock to manage simultaneous booking requests. This allows for high-performance, non-blocking reads (multiple users viewing seats) while ensuring thread-safe, exclusive writes (a single user completing a booking).

  • Autonomous Lock Cleanup: Utilizes a ScheduledExecutorService to run a background task that automatically detects and releases seat locks from abandoned user sessions after a timeout, ensuring seats are returned to the available pool.

  • SOLID Design Patterns: Implements key patterns for a decoupled and extensible architecture:

    Factory Pattern to dynamically create different PaymentStrategy objects (e.g., UPI, Debit Card).

    Observer Pattern to notify other components (like an email or analytics service) of successful bookings without coupling them to the BookingService.

    Strategy Pattern to allow various payment methods to be used interchangeably.

  • Layered Architecture: Built with a clear separation of concerns, dividing the application into distinct layers (Controllers, Services, Core Entities). This improves maintainability, testability, and makes the codebase easier to navigate and debug.

Tech Stack

Core Language: Java (17+)

Concurrency:

Java Concurrency Utilities (java.util.concurrent)

ScheduledExecutorService

ReentrantReadWriteLock

ConcurrentHashMap

Design & Architecture:

Layered Architecture (Controller-Service)

Factory Pattern

Observer Pattern

Strategy Pattern

Screenshots

Choice options

Concurrency with threads

Background thread cleaning expired bookings

Successful seat booking

About

Gender and Age prediction model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages