IDEMPIERE-5279 Improve PO to avoid calling cache reset unnecessarily (#1309)
This commit is contained in:
parent
eaaa26774c
commit
ef085e72d6
|
@ -2538,11 +2538,14 @@ public abstract class PO
|
|||
m_newValues = new Object[size];
|
||||
m_createNew = false;
|
||||
}
|
||||
if (!newRecord) {
|
||||
Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(p_info.getTableName(), get_ID()));
|
||||
if (!newRecord)
|
||||
MRecentItem.clearLabel(p_info.getAD_Table_ID(), get_ID());
|
||||
} else if (get_ID() > 0 && success)
|
||||
Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().newRecord(p_info.getTableName(), get_ID()));
|
||||
if (CacheMgt.get().hasCache(p_info.getTableName())) {
|
||||
if (!newRecord)
|
||||
Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(p_info.getTableName(), get_ID()));
|
||||
else if (get_ID() > 0 && success)
|
||||
Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().newRecord(p_info.getTableName(), get_ID()));
|
||||
}
|
||||
|
||||
return success;
|
||||
} // saveFinish
|
||||
|
|
|
@ -478,4 +478,14 @@ public class CacheMgt
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is there a cache for this table name?
|
||||
* @param tableName
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean hasCache(String tableName) {
|
||||
return m_tableNames.contains(tableName);
|
||||
}
|
||||
|
||||
} // CCache
|
||||
|
|
Loading…
Reference in New Issue