Sending object over TCP: http://stackoverflow.com/questions/5957790/how-do-you-send-a-user-defined-class-object-over-a-tcp-ip-network-connection-in How TCP streams in java work: http://www.javaworld.com/article/2077322/core-java/core-java-sockets-programming-in-java-a-tutorial.html Simple TCP client server example: https://systembash.com/a-simple-java-tcp-server-and-tcp-client/ Thread Pool - https://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html
MAINTENANCE DEPT
- Get machine list - main thread
- Query each machine for IFs and schedule- thread pool
- Listen for breakdowns, stop ongoing PM, perform CM, resume interrupted PM - BreakdownManagerThread
- Incorporate PM into schedule - main thread
- Convey PM incorporated schedule to all machines - thread pool
MACHINE
- Setup(parse Excel data sheet), connect to SchedulingDept - one time - main thread
- receive sans PM schedule, calculate IFs - main thread
- convey IFs to Maintenance Dept, listen for PM incorporated schedule - main thread
- Report current status - StatusThread
While running a job, if it is a PM job:
- Before running job wait for Maintenance Dept to arrive.
- While running job listen for PM interrupt due to breakdown of some other machine, listen for PM resume if interrupt occurs.
if it is a normal job:
- Simulate breakdown if any.
SCHEDULING DEPT
- Listen for joining machines - WelcomeThread
- Query machines for pending jobs - thread pool
- Create job schedule - main thread
- Send schedule to all machines - thread pool
- Listen and wait till all machines report that 8 hours are over - main thread