I have and Observable object with following object being shared:-
HashMap<String,HashSet<String>> data;
I have a put function which appends entries in the above data and notify the observers after getting enough data.
put(String k, String line){
if (!data.containsKey(key)) {
addNewKey(k, line);
}else{
data.get(key).appendToList(deviceid);
}
if (data.get(key).size() > writeSizePerList || data.size() > writeSizeLists || System.currentTimeMillis() > lastDumpTimestamp + waitTimeMillis) {
setChanged();
notifyObservers();
lastDumpTimestamp = System.currentTimeMillis();
}
}
However I am stuck in the function. I need to clear the data object once all the observers have already processed after notify call. How would I capture this event? I can't keep adding data due to scalability issues.
Aucun commentaire:
Enregistrer un commentaire