use of org.iobserve.common.record.ISessionEvent in project iobserve-analysis by research-iobserve.
the class EntryCallSequence method execute.
@Override
protected void execute() {
final ISessionEvent sessionEvent = this.sessionEventInputPort.receive();
if (sessionEvent != null) {
if (sessionEvent instanceof SessionStartEvent) {
this.sessions.put(UserSession.createUserSessionId(sessionEvent), new UserSession(sessionEvent.getHostname(), sessionEvent.getSessionId()));
}
if (sessionEvent instanceof SessionEndEvent) {
final UserSession session = this.sessions.get(UserSession.createUserSessionId(sessionEvent));
if (session != null) {
this.userSessionOutputPort.send(session);
this.sessions.remove(sessionEvent.getSessionId());
}
}
}
final PayloadAwareEntryCallEvent event = this.entryCallInputPort.receive();
if (event != null) {
/**
* add the event to the corresponding user session in case the user session is not yet
* available, create one.
*/
final String userSessionId = UserSession.createUserSessionId(event);
UserSession userSession = this.sessions.get(userSessionId);
if (userSession == null) {
userSession = new UserSession(event.getHostname(), event.getSessionId());
this.sessions.put(userSessionId, userSession);
// TODO this should trigger a warning.
}
userSession.add(event, true);
}
this.removeExpiredSessions();
}
Aggregations