}
if(mtype.equals("debug.numstates")) {
logger.error("JuggaloaderTimeBase(" + periodMillis + "), numstates: " + states.size());
}
JuggaloaderStreamState state = states.get(key);
if(mtype.equals("debug.state")) {
logger.error("JuggaloaderTimeBase(" + periodMillis + "), states: " + state);
}
// initialize the stream state variables if they aren't already there
//System.out.println("vasil: state null: " + (state == null));
if (state == null) {
if (false && mongoClient != null) { // TODO
List<Map<String, Object>> snapShots = mongoClient.getLastTwoTuples(accountId, metricName, periodMillis);
//System.out.println("vasil: snapShots null: " + (snapShots == null));
if (snapShots != null && snapShots.size() == 2) {
//System.out.println("vasil: snapShots 2");
//state = new JuggaloaderStreamState(snapShots.get(0), snapShots.get(1));
states.put(key, state);
if (tuple.getLongByField("metricTimestamp") <= Long.parseLong((String)snapShots.get(0).get("metricTimestamp"))) {
return null;
}
}
else {
//System.out.println("vasil: snapShots length not 2");
}
}
if (state == null) {
//System.out.println("vasil: state clean init");
state = new JuggaloaderStreamState(y, ts);
states.put(key, state);
}
}
if(mtype.equals("debug.set")) {