/** * Processes an incoming execution. * * @param executionTrace * The execution trace to process. */ @InputPort(name = INPUT_PORT_NAME_EXECUTION_TRACES, description = "Receives execution traces", eventTypes = { ExecutionTrace.class }) public void processExecutionTrace(final ExecutionTrace executionTrace) { synchronized (this) { // Purge timed-out sessions before processing the next trace final long currentTimestamp = executionTrace.getStartTimestamp(); this.processTimeouts(currentTimestamp, OUTPUT_PORT_NAME_EXECUTION_TRACE_SESSIONS, this.executionSessionTimeoutQueue, this.openExecutionBasedSessions); // Add the trace to the appropriate session and create it if necessary boolean existingSession = true; final String sessionId = executionTrace.getSessionId(); ExecutionTraceBasedSession session = this.openExecutionBasedSessions.get(sessionId); if (session == null) { session = new ExecutionTraceBasedSession(sessionId); final ExecutionTraceBasedSession previousSession = this.openExecutionBasedSessions.putIfAbsent(sessionId, session); existingSession = previousSession != null; } session.addTrace(executionTrace); // Update the changed session's position in the timeout queue if (existingSession) { this.executionSessionTimeoutQueue.remove(session); } this.executionSessionTimeoutQueue.add(session); } }