File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/main/java/com/reactnativecommunity/asyncstorage Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ if( newDbSize != null && newDbSize.isLong()) {
3030 dbSizeInMB = newDbSize. toLong()
3131}
3232
33+ def useCustomExecutor = rootProject. hasProperty(' AsyncStorage_useCustomExecutor' )
34+ ? rootProject. properties[' AsyncStorage_useCustomExecutor' ]
35+ : false
36+
3337apply plugin : ' com.android.library'
3438
3539android {
@@ -41,6 +45,7 @@ android {
4145 targetSdkVersion getExtOrIntegerDefault(' targetSdkVersion' )
4246
4347 buildConfigField " Long" , " AsyncStorage_db_size" , " ${ dbSizeInMB} L"
48+ buildConfigField(" boolean" , " AsyncStorage_useCustomExecutor" , " ${ useCustomExecutor} " )
4449 }
4550}
4651
Original file line number Diff line number Diff line change 2929import java .util .ArrayDeque ;
3030import java .util .HashSet ;
3131import java .util .concurrent .Executor ;
32+ import java .util .concurrent .Executors ;
3233
3334@ ReactModule (name = AsyncStorageModule .NAME )
3435public final class AsyncStorageModule
@@ -78,7 +79,12 @@ synchronized void scheduleNext() {
7879 private final SerialExecutor executor ;
7980
8081 public AsyncStorageModule (ReactApplicationContext reactContext ) {
81- this (reactContext , AsyncTask .THREAD_POOL_EXECUTOR );
82+ this (
83+ reactContext ,
84+ BuildConfig .AsyncStorage_useCustomExecutor
85+ ? Executors .newSingleThreadExecutor ()
86+ : AsyncTask .THREAD_POOL_EXECUTOR
87+ );
8288 }
8389
8490 @ VisibleForTesting
You can’t perform that action at this time.
0 commit comments