Giter Site home page Giter Site logo

dreamersun / android-database-locking-collisions-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 2point0/android-database-locking-collisions-example

0.0 2.0 0.0 159 KB

Show db locking and collisions with multiple connections

Home Page: http://www.touchlab.co/blog/android-sqlite-locking/

Java 100.00%

android-database-locking-collisions-example's Introduction

Example app showing how you can cause DB collisions pretty easily with multiple SQLiteHelper instances.

Also demonstrate dramatic time difference using transactions.

Button	:Description
1 Write	:Perform writes from multiple threads using only one instance of a DatabaseHelper. This should never cause a failure
+ Write	:Perform writes from multiple threads, each thread with its own DatabaseHelper. First failure in a thread will end that thread leaving only one thread able to complete it's process. The ticker bar should have one dominant color [blue,white,yellow,red] (red at beginning and end signify start and end of run)
1 Write + Read	:One thread performs writes while other threads perform reads. All threads have their own copy of DatabaseHelper. Failures can occur but if you're lucky, they won't.
+ Read	:All threads perform reads with their own copy of DatabaseHelper. Failures can occur but if you're lucky, they won't.
Test Transaction Isolation	:Interleaving reads and writes with the same copy of DatabaseHelper will not fail but transactions are exclusive and cannot be disturbed.
No Transaction	:Perform a timed series of writes individually 
Transaction :Perform a timed series of writes in a transaction
Exclusive No Yielding	:One long running transaction and many short running transactions are performed. Each transaction is exclusive and must complete before another transaction/operation is allowed. The ticker bar should show the long transaction finishing before trailing short transactions run.
Safely Contended Yield	:One long running transaction yielding at times to allow short running transactions to perform their operations. The ticker bar should show short transactions finishing before the long transaction finishes.
No Yield Read	:A thread performing writes in a transaction is followed by other threads performing reads. The write transaction must complete before reads can be made
Yield and Read	:A thread performing writes in a transaction yields to following threads performing reads. The yielding allows a few reads to execute before waiting for the entire write transaction to complete.

android-database-locking-collisions-example's People

Contributors

kpgalligan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.