-
Notifications
You must be signed in to change notification settings - Fork 0
Multithreading Routing Algorithm
jloh02 edited this page Dec 8, 2021
·
2 revisions
To ensure the routing is fast, for each src and des pair, a thread is created. The total execution time is also limited in the PathfinderExecutor.java
file using Java's ExecutorService
. When a path is found, it is added synchronously to a static array of Routes in PathfinderExecutor.java
. This allows for further optimization in the original Dijkstra code. A sub-route may now be cancelled if the current time is more than the 3rd fastest route.
The routes are then converted to strings to be returned to the client.