在我的应用程序(Spring Boot、Spring Data JPA、Spring Batch、Postgres DB)启动期间,我收到这样的警告:
2020-03-04 11:53:24.559 WARN [-,,,] 25743 --- [ main] o.s.b.a.batch.JpaBatchConfigurer : JPA does not support custom isolation levels, so locks may not be taken when launching Jobs
Run Code Online (Sandbox Code Playgroud)
我对 Spring Boot 隔离级别做了一些研究,我们有:DEFAULT、READ_COMMITTED、READ_UNCOMMITTED和。REPEATABLE_READSERIALIZABLE
从警告中我了解到 JPA 不支持这一点,但只需对给定的数据库使用 DEFAULT,在我的例子中,Postgres 是READ_COMMITTED.
我还读到 Spring 批处理事务的默认隔离级别是SERIALIZABLE 为了防止同一作业实例同时执行。
有人可以解释一下,我什么时候应该担心这个警告?我不知道我是否应该为此做点什么。
我知道软引用只会在 JVM 内存不足时释放。我怎样才能手动完成呢?
我的代码:
Object object = new Object();
ReferenceQueue queue = new ReferenceQueue();
SoftReference softReference= new SoftReference(object, queue);
object = null;
System.gc();
//now I force release soft reference.
Run Code Online (Sandbox Code Playgroud)
最新的java版本(8-11)有解决方案吗?
Spring Data 2.0 JpaRepository:findById()和之间的区别existsById()
findById()和existsById()方法?