use of org.apache.heron.api.Pair in project heron by twitter.
the class JoinOperator method execute.
@SuppressWarnings("unchecked")
@Override
public void execute(TupleWindow inputWindow) {
Map<K, Pair<List<V1>, List<V2>>> joinMap = new HashMap<>();
for (Tuple tuple : inputWindow.get()) {
if (tuple.getSourceComponent().equals(leftComponent)) {
V1 tup = (V1) tuple.getValue(0);
if (tup != null) {
addMapLeft(joinMap, tup);
}
} else {
V2 tup = (V2) tuple.getValue(0);
if (tup != null) {
addMapRight(joinMap, tup);
}
}
}
evaluateJoinMap(joinMap, inputWindow);
}
use of org.apache.heron.api.Pair in project heron by twitter.
the class InstanceUtils method prepareTimerEvents.
@SuppressWarnings("unchecked")
public static void prepareTimerEvents(ExecutorLooper looper, PhysicalPlanHelper helper) {
Map<String, Pair<Duration, Runnable>> timerEvents = (Map<String, Pair<Duration, Runnable>>) helper.getTopologyContext().getTopologyConfig().get(Config.TOPOLOGY_TIMER_EVENTS);
if (timerEvents != null) {
for (Map.Entry<String, Pair<Duration, Runnable>> entry : timerEvents.entrySet()) {
Duration duration = entry.getValue().getFirst();
Runnable task = entry.getValue().getSecond();
looper.registerPeriodicEvent(duration, task);
}
}
}