private void currentSessionTimeout(long eventTimestamp, WindowState state) {
        Map<String, Long> currentEndTimestamps = findAllCurrentEndTimestamps(state);

        //sort on endTimestamps
        if (currentEndTimestamps.size() > 1) {
            List<Map.Entry<String, Long>> toSort = new ArrayList<>();
            toSort.addAll(currentEndTimestamps.entrySet());
            toSort.sort(Map.Entry.comparingByValue());
            Map<String, Long> map = new LinkedHashMap<>();
            for (Map.Entry<String, Long> e : toSort) {
                map.putIfAbsent(e.getKey(), e.getValue());
            }
            currentEndTimestamps = map;
        }

        for (Map.Entry<String, Long> entry : currentEndTimestamps.entrySet()) {
            long sessionEndTime = entry.getValue();
            SessionComplexEventChunk<StreamEvent> currentSession = state.sessionMap.get(entry.getKey())
                    .getCurrentSession();
            SessionComplexEventChunk<StreamEvent> previousSession = state.sessionMap.get(entry.getKey())
                    .getPreviousSession();
            if (currentSession.getFirst() != null && eventTimestamp >= sessionEndTime) {

                if (allowedLatency > 0) {
                    //move current session to previous session
                    previousSession.add(currentSession.getFirst());
                    previousSession.setTimestamps(currentSession.getStartTimestamp(),
                            currentSession.getEndTimestamp(),
                            currentSession.getAliveTimestamp());
                    scheduler.notifyAt(currentSession.getAliveTimestamp());
                    currentSession.clear();
                } else {
                    state.expiredEventChunk.setKey(currentSession.getKey());
                    state.expiredEventChunk.setTimestamps(currentSession.getStartTimestamp(),
                            currentSession.getEndTimestamp(),
                            currentSession.getAliveTimestamp());
                    state.expiredEventChunk.add(currentSession.getFirst());
                    currentSession.clear();
                }
            } else {
                break;
            }
        }
    }
Checks all the sessions and get the expired session.
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java