Restaurant Management System
Client-server desktop system with threaded server, manual JDBC persistence, and role-based access - structured as three separate modules (server, client, common).
🍽️ Restaurant Management System
A client-server desktop application built as a final course project.
The system is split into three separate Java applications - Server, Client, and Common - that run independently but work together as a single system.
The focus was on exploring low-level networking, manual database access, and multithreading.
Architecture
- Server: standalone process listening on a TCP socket.
- Clients: Swing-based desktop apps that connect to the server.
- Common module: shared domain classes and protocol objects (requests, responses).
- Communication: object serialization over sockets (request/response model).
- Session management: a
Sessioncomponent tracks connected clients and prevents duplicate logins. - Role-based access: the client UI adapts based on the authenticated user’s role.
Concurrency Model
- Thread-per-client: the server spawns a new handler thread for each client connection.
- Session list: synchronized operations ensure safe add/remove of active clients.
- Active clients view: a dedicated thread periodically updates the UI table with the current session state.
⚠️ This approach works well for a training project. In production, an executor pool or NIO-based multiplexing would be used instead of unbounded threads.
Database Access
- Manual JDBC: a singleton connection class (
MyDatabaseConnection) provides access to the database. - SQL queries: written by hand using
PreparedStatementandResultSet, with manual mapping to domain objects. - Configuration: connection parameters read from a small utility class (
DbUtil). - Transactions: explicitly controlled within JDBC code.
⚠️ In modern applications this would be replaced by a connection pool (e.g., HikariCP) and an ORM layer (e.g., JPA/Hibernate via Spring Data).
Here it served as a low-level exercise in understanding JDBC, driver management, and transaction handling.
Key Capabilities
- User authentication with role-based authorization.
- Menu and order management through the client GUI.
- Multi-client session tracking on the server.
- Graceful shutdown of server and client sessions.
