data-area, it is not allowed to remove any data from the area. Similarly, for the Consumer to be able to remove information from the data area, there must be information there in the first place. Once again, the sole function of the Consumer is to remove data from the data area. http://www.dcs.ed.ac.uk/home/adamd/essays/ex1.html “This problem is one ... well-known problems in concurrent programming: a finite-size buffer and two classes of threads, producers and consumers, put items into the buffer (producers) and take items out of the buffer (consumers).” https://docs.oracle.com/cd/E19455-01/806-5257/sync-31/index.html Multi-process synchronization
information: even when the GPS doesn't work as expected. • Consider possible connection loss due bad reception or no connection to the server. • We needed to make sure that the data received by the server was complete and in the correct order. • Handle all possible failures. The Tracking Problem
there's no more GPS available (or not accurate enough). Position Consumer Service: fetches from the database all the positions that haven’t been sent yet, makes sure that they are sorted and executes the request. Handles possible failures with the sending. Position Interpolator Service: makes sure all positions have a location that can be mapped in the server. Linear Interpolation Architectural Design Overview
number to keep the correct order. After the positions are sent they are then marked as 'transmitted'. If the position with the upcoming sequence number is not complete, the consumer should wait until the interpolator does its job, and send the position.
location, the interpolator comes to the rescue. we always want to have an idea of where the devices are. This component checks the database looking for incomplete positions and does a linear Interpolation with last valid position and the next valid.
spaced by a given time interval all(): Returns an Observable that emits a Boolean that indicates whether all of the items emitted by the source Observable satisfy a condition. http://reactivex.io/RxJava/javadoc/index.html?rx/Observable.html
/ retry (error) - Handle errors: doOnError / onErrorReturn - Three independent components: - Separate concerns - Work asynchronously - Write test more easily - Code looks clean and tidy - Code is easy to read