Skip to content

EgglezosHub/Theater-Booking-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theater Booking System – Java RMI

Overview

Theater Booking System is a distributed application that allows clients to reserve, cancel, and view seats for a theater performance via Java RMI (Remote Method Invocation). It supports concurrent clients, maintains data consistency, and provides notifications when seats become available.


Features

  • ✅ Supports multiple seat zones with independent pricing and availability.
  • ✅ Clients can book and cancel seats remotely.
  • ✅ Clients can view current reservations and guest lists.
  • ✅ Notification mechanism: clients can subscribe for alerts when seats become available.
  • ✅ Handles concurrent clients gracefully via Java RMI.

Architecture

The application follows a Client-Server model using Java RMI.

  • THClient.java: Command-line client interface for issuing booking/cancellation/list requests.
  • THServer.java: Starts the server, exports the implementation, and binds it to the RMI registry.
  • THImpl.java: Implements the core business logic for reservations and notifications.
  • SeatType.java: Represents a seat category with price, availability, guest list, and subscriber list.
  • THInterface.java: Declares the remote methods available to clients.

Available Commands

  • java THClient list <hostname>: Lists all seat zones and their current availability and price.
  • java THClient book <type> <number> <name> <hostname>: Books a number of seats of the specified type for the given guest.
  • java THClient cancel <type> <number> <name> <hostname>: Cancels reservations for the guest in the specified zone.
  • java THClient guests <hostname>: Displays all guests and their reservations.

Seat Zones

CodeDescriptionSeatsPrice (€)
ΠΑΠλατεία - Ζώνη Α10050
ΠΒΠλατεία - Ζώνη Β20040
ΠΓΠλατεία - Ζώνη Γ30030
ΚΕΚεντρικός Εξώστης25035
ΠΘΠλαϊνά Θεωρεία5025

Build & Run

Compile

javac *.java

Start RMI Registry

rmiregistry

Start the Server

java THServer

Run Client Commands

java THClient list localhost
java THClient book ΠΑ 2 Maria localhost
java THClient cancel ΠΑ 1 Maria localhost
java THClient guests localhost

Sample Output

$ java THClient list localhost
100 θέσεις Πλατεία - Ζώνη Α (κωδικός: ΠΑ) - τιμή: 50 Ευρώ
200 θέσεις Πλατεία - Ζώνη Β (κωδικός: ΠΒ) - τιμή: 40 Ευρώ
...

$ java THClient book ΠΑ 2 Maria localhost success: 100 euros

$ java THClient cancel ΠΑ 1 Maria localhost success: 1 reservations left

$ java THClient guests localhost total guests: 1 Maria (1)


Notification Feature

  • If a booking fails due to no availability, the client is asked if they wish to subscribe to notifications.
  • When a cancellation frees up seats, subscribed clients are notified on their next interaction.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages