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.
- ✅ 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.
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.
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.
| Code | Description | Seats | Price (€) |
|---|---|---|---|
| ΠΑ | Πλατεία - Ζώνη Α | 100 | 50 |
| ΠΒ | Πλατεία - Ζώνη Β | 200 | 40 |
| ΠΓ | Πλατεία - Ζώνη Γ | 300 | 30 |
| ΚΕ | Κεντρικός Εξώστης | 250 | 35 |
| ΠΘ | Πλαϊνά Θεωρεία | 50 | 25 |
javac *.javarmiregistryjava THServerjava THClient list localhost
java THClient book ΠΑ 2 Maria localhost
java THClient cancel ΠΑ 1 Maria localhost
java THClient guests localhost
$ 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)
- 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.