Class AsyncQLiteConnection

  • All Implemented Interfaces:

    
    public final class AsyncQLiteConnection
    
                        

    A wrapper for SQLiteConnection to provide asynchronous capabilities.

    All SQL calls from concurrent threads must go through this wrapper class to ensure serial access.

    Since:

    0.0.1

    Author:

    Ron Lauren Hombre

    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final SQLiteConnection getSynced()
      final Unit execSQL(String sql, Function1<Exception, Unit> onSuccess) Adds the SQL to the Job Queue to be executed.
      final AsyncQLiteStatement prepare(String sql, Function1<Exception, Unit> onSuccess) Prepares a virtual SQL Statement and adds it to the Job Queue with AsyncQLiteStatement.step.
      final Unit close() Signals the Consumer Thread to die once the Job Queue is empty.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getSynced

         final SQLiteConnection getSynced()
      • execSQL

         final Unit execSQL(String sql, Function1<Exception, Unit> onSuccess)

        Adds the SQL to the Job Queue to be executed.

        This returns nothing.

        Parameters:
        sql - The SQL Statement.
        onSuccess - Called after the SQL has been executed in the Job Queue.
      • close

         final Unit close()

        Signals the Consumer Thread to die once the Job Queue is empty. This also prevents further addition to the queue.

        This is a blocking method that waits for the Consumer Thread before closing the wrapped SQLiteConnection.