Search in sources :

Example 1 with LSTopoHistoryList

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));
}
Also used : ArrayList(java.util.ArrayList) LSTopoHistoryList(org.apache.storm.generated.LSTopoHistoryList) LSTopoHistory(org.apache.storm.generated.LSTopoHistory)

Example 2 with LSTopoHistoryList

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));
}
Also used : ArrayList(java.util.ArrayList) LSTopoHistoryList(org.apache.storm.generated.LSTopoHistoryList) LSTopoHistory(org.apache.storm.generated.LSTopoHistory)

Aggregations

ArrayList (java.util.ArrayList)2 LSTopoHistory (org.apache.storm.generated.LSTopoHistory)2 LSTopoHistoryList (org.apache.storm.generated.LSTopoHistoryList)2