/** * @param handle handle of SQLOperation. * @return display representing a particular SQLOperation. */ public QueryInfo getQueryInfo(String handle) { synchronized (webuiLock) { if (historicalQueryInfos == null) { return null; } QueryInfo result = liveQueryInfos.get(handle); if (result != null) { return result; } return historicalQueryInfos.get(handle); } }
private void removeSafeQueryInfo(OperationHandle operationHandle) { synchronized (webuiLock) { String opKey = operationHandle.getHandleIdentifier().toString(); // remove from list of live operations QueryInfo display = liveQueryInfos.remove(opKey); if (display == null) { LOG.debug("Unexpected display object value of null for operation {}", opKey); } else if (historicalQueryInfos != null) { // add to list of saved historic operations historicalQueryInfos.put(opKey, display); } } }
@Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > capacity; } }
@Override public synchronized void init(HiveConf hiveConf) { LogDivertAppender.registerRoutingAppender(hiveConf); LogDivertAppenderForTest.registerRoutingAppenderIfInTest(hiveConf); if (hiveConf.isWebUiQueryInfoCacheEnabled()) { historicalQueryInfos = new QueryInfoCache( hiveConf.getIntVar(ConfVars.HIVE_SERVER2_WEBUI_MAX_HISTORIC_QUERIES)); } super.init(hiveConf); }
/** * @return displays representing a number of historical SQLOperations, at max number of * hive.server2.webui.max.historic.queries. Newest items will be first. */ public List<QueryInfo> getHistoricalQueryInfos() { List<QueryInfo> result = new LinkedList<>(); synchronized (webuiLock) { if (historicalQueryInfos != null) { result.addAll(historicalQueryInfos.values()); Collections.reverse(result); } } return result; }
@Override public synchronized void init(HiveConf hiveConf) { LogDivertAppender.registerRoutingAppender(hiveConf); LogDivertAppenderForTest.registerRoutingAppenderIfInTest(hiveConf); if (hiveConf.isWebUiQueryInfoCacheEnabled()) { historicalQueryInfos = new QueryInfoCache( hiveConf.getIntVar(ConfVars.HIVE_SERVER2_WEBUI_MAX_HISTORIC_QUERIES)); } super.init(hiveConf); }
/** * @return displays representing a number of historical SQLOperations, at max number of * hive.server2.webui.max.historic.queries. Newest items will be first. */ public List<QueryInfo> getHistoricalQueryInfos() { List<QueryInfo> result = new LinkedList<>(); synchronized (webuiLock) { if (historicalQueryInfos != null) { result.addAll(historicalQueryInfos.values()); Collections.reverse(result); } } return result; }
@Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > capacity; } }
private void removeSafeQueryInfo(OperationHandle operationHandle) { synchronized (webuiLock) { String opKey = operationHandle.getHandleIdentifier().toString(); // remove from list of live operations QueryInfo display = liveQueryInfos.remove(opKey); if (display == null) { LOG.debug("Unexpected display object value of null for operation {}", opKey); } else if (historicalQueryInfos != null) { // add to list of saved historic operations historicalQueryInfos.put(opKey, display); } } }
/** * @param handle handle of SQLOperation. * @return display representing a particular SQLOperation. */ public QueryInfo getQueryInfo(String handle) { synchronized (webuiLock) { if (historicalQueryInfos == null) { return null; } QueryInfo result = liveQueryInfos.get(handle); if (result != null) { return result; } return historicalQueryInfos.get(handle); } }