context = new SessionContext();
// Set event index to current last index, so events fired before creation of this context are not executed for it
LinkedMap list = TMLPortlet.getFiredEventsQueue(session);
if (!list.isEmpty()) {
PortletEvent event = (PortletEvent) list.get(list.lastKey());
context.setLastProcessedEventIndex(event.getIndex());
}
contexts.put(completeKey, context);
}