*.mdb文件可以同时以两个线程打开吗?
Android Object Box版本3.1.2
Flutter Object Box 1.4.1
Android代码确实读/写操作
仅会读取操作
有时,Android侧 。 无法更新TX(此线程上的另一个读取事务仍处于活动状态)(错误代码-30783)
当我仅使用Android时,永远不会发生这种例外。
Android:
boxStore = MyObjectBox.builder().androidContext(application).build()
颤抖:
final documentDir = await getApplicationDocumentsDirectory();
var androidDir =
'${documentDir.parent.absolute.path}/files/objectbox/objectbox/';
var objectboxDir = Directory(androidDir);
var exists = await objectboxDir.exists();
if (!exists) {
objectboxDir.create(recursive: true);
}
store = await openStore(directory: androidDir);
Android Objectbox Version 3.1.2
Flutter Objectbox Version 1.4.1
Android code does read/write operation
Flutter code only does read operation
Sometimes the android side throws this exception:
Could not renew tx (another read transaction is still active on this thread) (error code -30783)
This exception never occurs when I use android only.
Android:
boxStore = MyObjectBox.builder().androidContext(application).build()
Flutter:
final documentDir = await getApplicationDocumentsDirectory();
var androidDir =
'${documentDir.parent.absolute.path}/files/objectbox/objectbox/';
var objectboxDir = Directory(androidDir);
var exists = await objectboxDir.exists();
if (!exists) {
objectboxDir.create(recursive: true);
}
store = await openStore(directory: androidDir);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
拥有两个Libs似乎是一个棘手的设置...您确定您是否在DART中使用不同的线程(例如隔离)(或者在Android中)?因为错误“另一个读取事务仍然在此线程上处于活动状态”,就像使用同一线程一样读取。在这种情况下,每个LIB的某些线程 - 本地缓存将干扰另一个LIB。
因此,请确保永远不要在两个Libs上使用相同的线程。
Having the two libs seems like a tricky setup... Are you sure you are using distinct threads (e.g. isolates) in Dart (or alternatively, in Android)? Because the error "another read transaction is still active on this thread" reads rather like the same thread is used. In that case, some thread-local caching of each lib will interfere with the other lib.
Thus, make sure that never use the same thread on both libs.