AbstractQueue<byte[]> sizeQueue = getClientQueue(clientInfo[1]);
if (sizeQueue == null) {
return null;
}
int size = sizeQueue.size();
LocalCacheElement element = new LocalCacheElement(keystring, 0, 0, 0);
element.setData(String.valueOf(size).getBytes());
return element;
} catch (Exception e) {
log.error("getsize " + keystring + "error", e);
return null;
}
}
// 清空队列中所有的元素
if (keystring.startsWith("clear")) {
try {
// clear|bbs|pass
String[] clientInfo = QueueClient.parse(keystring, '|');
if (clientInfo.length < 3 || valid(clientInfo[1], clientInfo[2]) == false) {
throw new ClientException("Authorization error");
}
AbstractQueue<byte[]> queue = getClientQueue(clientInfo[1]);
queue.clear();
LocalCacheElement element = new LocalCacheElement(keystring, 0, 0, 0);
element.setData(String.valueOf(queue.size()).getBytes());
return element;
} catch (Exception e) {
log.error("getsize " + keystring + "error", e);
return null;
}
}
// 重新加载权限信息
if (keystring.startsWith("reload")) {
try {
// reload|bbs|pass
String[] clientInfo = QueueClient.parse(keystring, '|');
if (clientInfo.length < 3 || valid(clientInfo[1], clientInfo[2]) == false) {
throw new ClientException("Authorization error");
}
reloadAuthorization();
LocalCacheElement element = new LocalCacheElement(keystring, 0, 0, 0);
element.setData("reloadAuthorization".getBytes());
return element;
} catch (ConfigException e) {
log.error(e.getMessage(), e);
} catch (Exception e) {
log.error("reloadAuthorization error", e);