concurrent 异常处理
This commit is contained in:
parent
0b91a47f05
commit
e5c70e3d25
|
|
@ -246,14 +246,19 @@ abstract class BaseRecordHelper<T: BaseRecord> {
|
|||
|
||||
|
||||
fun getRecordList(): List<T> {
|
||||
try {
|
||||
mRecordLocker.lock()
|
||||
return mRecordList.toList()
|
||||
} finally {
|
||||
mRecordLocker.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
protected fun saveRecordList2Sp() {
|
||||
mbgScope.launch {
|
||||
try {
|
||||
mRecordLocker.lock()
|
||||
SpUtil.instance().putList(mSpKey, mRecordList)
|
||||
SpUtil.instance().putList(mSpKey, getRecordList())
|
||||
} finally {
|
||||
mRecordLocker.unlock()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue