Mark
05/02/2021, 2:05 AMMark
05/02/2021, 2:08 AMDeferred<Database>
? Any thoughts on that approach?dave08
05/02/2021, 9:36 AMMark
05/02/2021, 9:46 AMdave08
05/02/2021, 9:51 AMMark
05/02/2021, 9:52 AMdave08
05/02/2021, 9:56 AMdave08
05/02/2021, 9:57 AMMark
05/02/2021, 9:58 AMdave08
05/02/2021, 10:00 AMdave08
05/02/2021, 10:01 AMMark
05/02/2021, 10:01 AMdave08
05/02/2021, 10:02 AMdave08
05/02/2021, 10:03 AMLazy<...>
by using kotlin's lazyOf { }
in certain trickier cases...dave08
05/02/2021, 10:05 AMLazy
will only be initialized when first accessed. But in general, instantiating a class doesn't do anything until first used...dave08
05/02/2021, 10:09 AMMark
05/02/2021, 10:14 AMDeferred<SQLiteDatabase>
(as a dependency) since anyway access to the database is being done on an I/O thread. This deferred would only be ‘completed’ once it is actually ready (e.g. when startup initialisation has completed).dave08
05/02/2021, 11:08 AMMark
05/02/2021, 11:32 AMdave08
05/02/2021, 11:35 AMMark
05/02/2021, 11:36 AMCompletableDeferred
and set the sql database value when initialisation has completed. So anything that is waiting on that database, is automatically ‘unpaused’ when the value is set.dave08
05/02/2021, 11:40 AMMark
05/02/2021, 11:41 AMMark
05/02/2021, 11:45 AMdave08
05/02/2021, 11:45 AMdave08
05/02/2021, 11:46 AMMark
05/02/2021, 11:47 AMMark
05/02/2021, 11:48 AM