use of org.openkilda.wfm.topology.ping.model.CollectorDescriptor in project open-kilda by telstra.
the class GroupCollector method saveCurrentRecord.
private CollectorDescriptor saveCurrentRecord(Tuple input) throws Exception {
final PingContext pingContext = pullPingContext(input);
// expiring is only a memory leakage protection in this place
// waiting ping command timeout + storm internal processing delay milliseconds
long expireAt = System.currentTimeMillis() + pingContext.getTimeout() + expireDelay;
CollectorDescriptor descriptor = new CollectorDescriptor(expireAt, pingContext.getGroup());
descriptor = cache.addIfAbsent(descriptor);
try {
int size = descriptor.add(pingContext);
GroupId group = descriptor.getGroupId();
log.debug("Group {} add {} of {} response {}", group.getId(), size, group.getSize(), pingContext);
} catch (IllegalArgumentException e) {
throw new WorkflowException(this, input, e.toString());
}
return descriptor;
}
use of org.openkilda.wfm.topology.ping.model.CollectorDescriptor in project open-kilda by telstra.
the class GroupCollector method collect.
private void collect(Tuple input) throws Exception {
CollectorDescriptor descriptor = saveCurrentRecord(input);
if (descriptor.isCompleted()) {
try {
Group group = descriptor.makeGroup();
emitGroup(input, group);
} catch (IllegalStateException e) {
throw new WorkflowException(this, input, e.toString());
}
}
}
Aggregations