public ExecutableOutputPO getJobOutputDigest(String uuid) { return executableOutputDigestMap.get(uuid); }
public ExecutablePO getJobDigest(String uuid) { return executableDigestMap.get(uuid); }
public KafkaConfig getKafkaConfig(String name) { try (AutoLock l = lock.lockForRead()) { return kafkaMap.get(name); } }
public ProjectInstance getProject(String projectName) { // Null check is needed for ConcurrentMap does not supporting .get(null) if (projectName == null) return null; try (AutoLock lock = prjMapLock.lockForRead()) { return projectMap.get(projectName); } }
public DataModelDesc getDataModelDesc(String name) { try (AutoLock lock = modelMapLock.lockForRead()) { return dataModelDescMap.get(name); } }
public ManagedUser get(String name) { try (AutoReadWriteLock.AutoLock l = lock.lockForRead()) { return userMap.get(name); } }
public ExternalFilterDesc getExtFilterDesc(String filterTableName) { try (AutoLock lock = extFilterMapLock.lockForRead()) { ExternalFilterDesc result = extFilterMap.get(filterTableName); return result; } }
public CubeInstance getCube(String cubeName) { try (AutoLock lock = cubeMapLock.lockForRead()) { return cubeMap.get(cubeName); } }
public CubeDesc getCubeDesc(String name) { try (AutoLock lock = descMapLock.lockForRead()) { return cubeDescMap.get(name); } }
public StreamingConfig getStreamingConfig(String name) { try (AutoLock l = lock.lockForRead()) { return streamingMap.get(name); } }
public HybridInstance getHybridInstance(String name) { try (AutoLock l = lock.lockForRead()) { return hybridMap.get(name); } }
@Nullable private AclRecord getAclRecordByCache(String id) { try (AutoLock l = lock.lockForRead()) { if (aclMap.size() > 0) { return aclMap.get(id); } } try (AutoLock l = lock.lockForWrite()) { crud.reloadAll(); return aclMap.get(id); } catch (IOException e) { throw new RuntimeException("Can not get ACL record from cache.", e); } }
public TableACL getTableACLByCache(String project) { try (AutoLock l = lock.lockForRead()) { TableACL tableACL = tableACLMap.get(project); if (tableACL == null) { return newTableACL(project); } return tableACL; } }
public TempStatementEntity getTempStatEntity(String sessionId, String statementId) { try (AutoLock l = lock.lockForRead()) { return tmpStatMap.get(TempStatementEntity.resourceName(sessionId, statementId)); } }
public void removeCubeLocal(String cubeName) { try (AutoLock lock = cubeMapLock.lockForWrite()) { CubeInstance cube = cubeMap.get(cubeName); if (cube != null) { cubeMap.removeLocal(cubeName); for (CubeSegment segment : cube.getSegments()) { usedStorageLocation.remove(segment.getUuid()); } Cuboid.clearCache(cube); } } }
public void update(ManagedUser user) { try (AutoReadWriteLock.AutoLock l = lock.lockForWrite()) { ManagedUser exist = userMap.get(user.getUsername()); if (exist != null) { user.setLastModified(exist.getLastModified()); } user.setUsername(user.getUsername().toUpperCase(Locale.ROOT)); crud.save(user); } catch (IOException e) { throw new RuntimeException("Can not update user.", e); } }
/** * Make sure the returned table desc is project-specific. * * All locks on srcTableMapLock are WRITE LOCKS because of this method!! */ private TableDesc getProjectSpecificTableDesc(String fullTableName, String prj) { String key = mapKey(fullTableName, prj); TableDesc result = srcTableMap.get(key); if (result == null) { try (AutoLock lock = srcTableMapLock.lockForWrite()) { result = srcTableMap.get(mapKey(fullTableName, null)); if (result != null) { result = new TableDesc(result);// deep copy of global tabledesc result.setLastModified(0); result.setProject(prj); result.setBorrowedFromGlobal(true); srcTableMap.putLocal(key, result); } } } return result; }
public TableExtDesc getTableExt(TableDesc t) { try (AutoLock lock = srcExtMapLock.lockForRead()) { TableExtDesc result = srcExtMap.get(mapKey(t.getIdentity(), t.getProject())); if (null == result) { //TODO: notice the table ext is not project-specific, seems not necessary at all result = srcExtMap.get(mapKey(t.getIdentity(), null)); } // avoid returning null, since the TableDesc exists if (null == result) { result = new TableExtDesc(); result.setIdentity(t.getIdentity()); result.setUuid(RandomUtil.randomUUID().toString()); result.setLastModified(0); result.init(t.getProject()); srcExtMap.putLocal(mapKey(t.getIdentity(), t.getProject()), result); } return result; } }
/** * the project-specific table desc will be expand by computed columns from the projects' models * when the projects' model list changed, project-specific table should be reset and get expanded * again */ public void resetProjectSpecificTableDesc(String prj) throws IOException { // avoid cyclic locks ProjectInstance project = ProjectManager.getInstance(config).getProject(prj); try (AutoLock lock = srcTableMapLock.lockForWrite()) { for (String tableName : project.getTables()) { String tableIdentity = getTableIdentity(tableName); String key = mapKey(tableIdentity, prj); TableDesc originTableDesc = srcTableMap.get(key); if (originTableDesc == null) { continue; } if (originTableDesc.isBorrowedFromGlobal()) { srcTableMap.removeLocal(key);//delete it so that getProjectSpecificTableDesc will create again } else { srcTableCrud.reload(key); } } } }
public DataModelDesc getDataModelDesc(String name) { try (AutoLock lock = modelMapLock.lockForRead()) { return dataModelDescMap.get(name); } }