Skip to content
jordanell edited this page Jul 3, 2012 · 1 revision

This project relies heavily on asynchronous database calls and inserts. A brief description of its inner workings can be found below on this page.

Queue

This project creates a virtual database access queue. Whenever an access to the database is requested, the request is sent to a queue where it waits until it is preformed and then removed from the queue.

The queue has a maximum size which is set inside of the DbConnection class. If the queue ever gets to this size limit, it will pause the program which is adding to the queue and attempt to empty the queue enough so that it dips below this limiting and, at which time it will resume the adding program.

Workers

In order to process items on the queue, the database project spawns threads that we call workers. The workers will take items that are on the queue and process them individually and then remove them from the queue.

The number of workers that are generated is set inside of the DbConnection class.

Because the workers are spawned inside of the DbConnection class after a database connection has been established, you must terminate the database connection through the close() method in order to terminate the worker threads.

Notes

Not all of the predefined methods inside of the DbConnection class use asynchronous database calls, although most of them do. It is worth while to check when using a predefined method to see if it is asynchronous or not as this may help with any troubleshooting.

Clone this wiki locally