使用 objectbox 的网络服务器上有很多警告

问题描述

我在带有 ObjectBox 的 nginx 代理后面使用 SparkJava(基本上是 Jetty)网络服务器。

我开始注意到很多

Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
Hint: use closeThreadResources() to avoid finalizing recycled transactions (initial commit count: 213).
038-22:43:52.3260 [WARN ] Skipping low-level close for read-only cursor (non-creator thread 'java')
038-22:43:52.5815 [WARN ] Skipping low-level close for read-only cursor (non-creator thread 'java')
038-22:43:52.5815 [WARN ] Skipping low-level close for read-only cursor (non-creator thread 'java')
038-22:43:52.5815 [WARN ] Destroyed recycled transaction from non-owner thread 'java'
038-22:43:52.5820 [WARN ] Skipping low-level close for read-only cursor (non-creator thread 'java')
038-22:43:52.5820 [WARN ] Destroyed recycled transaction from non-owner thread 'java'
038-22:43:52.5821 [WARN ] Skipping low-level close for read-only cursor (non-creator thread 'java')

警告,在我的日志中,我正在想办法解决这个问题。

我所看到的建议可能是按照提示中的建议调用 closeThreadResources(),可能是在每次调用完成之后。但是,我不是 Jetty 的专家,不确定每个线程是否可能被杀死或重用。如果线程被重用,调用 closeThreadResources() 可能会中断?另外,我有多个 ObjectBox 框,因此我可能必须记住使用了哪些框,或者对所有这些框调用 closeThreadResources()。不完美,但可行。

在阅读https://github.com/objectbox/objectbox-java/issues/753#issuecomment-525314808之后,还有可能重用查询,这可能会解决问题。我可能会重做我的大部分代码来创建查询一次,然后在使用时设置参数值。当被网络服务器使用时,它的线程安全性如何?即如果我更改查询的值以使用它,并且它已经被另一个线程使用,会发生什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)