Skip to content

JSON database using GSON library, thread synchronization (multithreading), framework JCommander and sockets.

Notifications You must be signed in to change notification settings

Rutzno/json-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON-Database

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and for machines to parse and generate. It is less verbose and more readable than XML. The JSON filename extension is .json. The official Internet media type for JSON is application/json.

GSON is a Java serialization/deserialization library to convert Java Objects into JSON and vice versa. Gson was created by Google for internal use and later open sourced.

JCommander is a very small Java framework that makes it trivial to parse command line parameters. You annotate fields with descriptions of your options.

We need synchronization because all our threads will work with the same file. Since we can't write the file in two separate threads simultaneously, we used java.util.concurrent.locks.ReentrantReadWriteLock class, an implementation of the ReadWriteLock interface which provides a pair of read-write lock. It allows multiple readers of the resource but only a single writer. Once a writer locks the resource, it waits until all the readers finish reading and only then starts to write. The readers can freely read the file even though other readers locked it, but if the writer locks the file, no readers can read it.

</>

About

JSON database using GSON library, thread synchronization (multithreading), framework JCommander and sockets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages