This commit is contained in:
@@ -142,16 +142,16 @@ public final class EntityInfo<T> {
|
|||||||
static <T> EntityInfo<T> load(Class<T> clazz, final boolean cacheForbidden, final Properties conf,
|
static <T> EntityInfo<T> load(Class<T> clazz, final boolean cacheForbidden, final Properties conf,
|
||||||
DataSource source, BiFunction<DataSource, Class, List> fullloader) {
|
DataSource source, BiFunction<DataSource, Class, List> fullloader) {
|
||||||
EntityInfo rs = entityInfos.get(clazz);
|
EntityInfo rs = entityInfos.get(clazz);
|
||||||
if (rs != null) return rs;
|
if (rs != null && (rs.cache == null || rs.cache.isFullLoaded())) return rs;
|
||||||
synchronized (entityInfos) {
|
synchronized (entityInfos) {
|
||||||
rs = entityInfos.get(clazz);
|
rs = entityInfos.get(clazz);
|
||||||
if (rs == null) {
|
if (rs == null) {
|
||||||
rs = new EntityInfo(clazz, cacheForbidden, conf, source, fullloader);
|
rs = new EntityInfo(clazz, cacheForbidden, conf, source, fullloader);
|
||||||
|
entityInfos.put(clazz, rs);
|
||||||
if (rs.cache != null) {
|
if (rs.cache != null) {
|
||||||
if (fullloader == null) throw new IllegalArgumentException(clazz.getName() + " auto loader is illegal");
|
if (fullloader == null) throw new IllegalArgumentException(clazz.getName() + " auto loader is illegal");
|
||||||
rs.cache.fullLoad();
|
rs.cache.fullLoad();
|
||||||
}
|
}
|
||||||
entityInfos.put(clazz, rs);
|
|
||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user