Currently the values fetched from the database by the class Inmates are returned to the caller via a passed in queue mechanism. This exposes the implementation mechanism too much. A cleaner and more future friendly approach would be to use a callback mechanism. The caller would pass in the callback instead of the queue. The callee once the processing is completed would invoke this function with the return value. It is the responsibility of the callback function to make sure that the return value is sent to the calling object for processing.
Currently the values fetched from the database by the class Inmates are returned to the caller via a passed in queue mechanism. This exposes the implementation mechanism too much. A cleaner and more future friendly approach would be to use a callback mechanism. The caller would pass in the callback instead of the queue. The callee once the processing is completed would invoke this function with the return value. It is the responsibility of the callback function to make sure that the return value is sent to the calling object for processing.