https://github.com/alphabetsalphabets/ccp-airport
https://github.com/alphabetsalphabets/ccp-airport
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alphabetsalphabets/ccp-airport
- Owner: AlphabetsAlphabets
- Created: 2024-06-28T11:06:03.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-28T13:51:09.000Z (over 1 year ago)
- Last Synced: 2025-03-14T14:22:09.622Z (9 months ago)
- Language: Java
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# References
Learned how to use `Condition` class from https://www.byteslounge.com/tutorials/lock-conditions-in-java
Learned how to use `ReentrantLock` from https://jakob.jenkov.com/tutorials/java-util-concurrent/lock.html
Learned about the BlockingQueue from https://www.baeldung.com/java-blocking-queue
This thread serves the planes. Once the planes have finished their tasks. The thread will end. Which is why it is set as a daemon thread. Source: https://www.baeldung.com/java-daemon-thread
Semaphore general definition - https://www.baeldung.com/cs/semaphore
Semaphore in Java - https://www.baeldung.com/java-semaphore
# Important
Solves the unable to land 4th plane problem.
Context: There are 4 planes, and 3 gates. 3 planes occupy 3 gates. 1 plane is done and leaves, leaving 1 empty gate. But, the 4th plane doesn't land.
```java
can_depart.signalAll(); // tells other planes that are waiting to depart that they can.
can_land.signalAll(); // tells planes waiting to land that they can land as at this point
// a gate and a runway is free.
```
# private void postLandingTasks()
The function will call and create a bunch of other threads to perform clean up, passenger disembarking/embarking and refilling supplies after the plane lands.
# Fuel Truck
Will keep running and checking if a plane is ready to be refueled. Otherwise it does nothing.