
prerna.util.EngineSyncUtility Maven / Gradle / Ivy
The newest version!
package prerna.util;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.ReentrantLock;
import prerna.auth.User;
import prerna.auth.utils.SecurityAdminUtils;
public class EngineSyncUtility {
private static ConcurrentMap engineLocks = new ConcurrentHashMap<>();
// store some database metadata as well
public static ConcurrentMap> databaseStructureCache = new ConcurrentHashMap<>();
public static ConcurrentMap> metamodelCache = new ConcurrentHashMap<>();
public static ConcurrentMap>> metamodelLogicalNamesCache = new ConcurrentHashMap<>();
public static ConcurrentMap> metamodelDescriptionsCache = new ConcurrentHashMap<>();
public static ConcurrentMap> metamodelPositionsCache = new ConcurrentHashMap<>();
public static ReentrantLock getEngineLock(String engineId) {
engineLocks.putIfAbsent(engineId, new ReentrantLock());
return engineLocks.get(engineId);
}
public static ConcurrentMap getAllLocks(User user) {
if(!SecurityAdminUtils.userIsAdmin(user)) {
throw new IllegalArgumentException("User must be an admin to perform this method");
}
return engineLocks;
}
/**
* Get the database structure cache
* @param engineId
* @return
*/
public static List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy