I have task to do. I have to create 4 services A,B,C and D. Each service should have his own thread. A service should only start after all the services that it depends on are started and A service should only stop after all the services that depend on it are stopped. Services should be started and stopped in parallel whenever possible. Services B and C depend on Service A Service D depends on Service B To start service D, service A and B need to be started To stop service A, service B, D and C must be stopped first Service B and C can be started in parallel immediately after A has started. Conversely, they can stop in parallel.
Do you have any suggestions how to solve this? I'm trying to do it for last 10 days...Can i do it with CountDownLatch or with something else? Any advice is appreciable.