use of org.apache.storm.generated.LSTopoHistoryList in project storm by apache.
the class LocalState method addTopologyHistory.
public void addTopologyHistory(LSTopoHistory lsTopoHistory) {
LSTopoHistoryList lsTopoHistoryListWrapper = (LSTopoHistoryList) get(LS_TOPO_HISTORY);
List<LSTopoHistory> currentTopoHistoryList = new ArrayList<>();
if (null != lsTopoHistoryListWrapper) {
currentTopoHistoryList.addAll(lsTopoHistoryListWrapper.get_topo_history());
}
currentTopoHistoryList.add(lsTopoHistory);
put(LS_TOPO_HISTORY, new LSTopoHistoryList(currentTopoHistoryList));
}
use of org.apache.storm.generated.LSTopoHistoryList in project storm by apache.
the class LocalState method filterOldTopologies.
/**
* Remove topologies from local state which are older than cutOffAge.
* @param cutOffAge
*/
public void filterOldTopologies(long cutOffAge) {
LSTopoHistoryList lsTopoHistoryListWrapper = (LSTopoHistoryList) get(LS_TOPO_HISTORY);
List<LSTopoHistory> filteredTopoHistoryList = new ArrayList<>();
if (null != lsTopoHistoryListWrapper) {
for (LSTopoHistory topoHistory : lsTopoHistoryListWrapper.get_topo_history()) {
if (topoHistory.get_time_stamp() > cutOffAge) {
filteredTopoHistoryList.add(topoHistory);
}
}
}
put(LS_TOPO_HISTORY, new LSTopoHistoryList(filteredTopoHistoryList));
}
Aggregations