+ if (message.equals("CALCULATE"))
+ {
+ AdderResult result = state.get(partition).calculate(user);
+ log.info("{} - New result for {}: {}", id, user, result);
+ results.addResults(partition, user, result);
+ }
+ else
+ {
+ state.get(partition).addToSum(user, Integer.parseInt(message));
+ }
+
+ next.put(partition, record.offset() + 1);
+
+ if (throttle.isPresent())
+ {
+ try
+ {
+ Thread.sleep(throttle.get().toMillis());
+ }
+ catch (InterruptedException e)
+ {
+ log.warn("{} - Intrerrupted while throttling: {}", id, e);
+ }
+ }