001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2011-2011 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.server.monitor;
011
012import mondrian.server.Execution;
013
014/**
015 * Event concerning the execution of an MDX statement.
016 */
017public class ExecutionEndEvent extends ExecutionEvent {
018    public final int phaseCount;
019    public final Execution.State state;
020    public final int cellCacheHitCount;
021    public final int cellCacheMissCount;
022    public final int cellCachePendingCount;
023
024    /**
025     * Creates an ExecutionEndEvent.
026     *
027     * @param timestamp Timestamp
028     * @param serverId Server id
029     * @param connectionId Connection id
030     * @param statementId Statement id
031     * @param executionId Execution id
032     * @param phaseCount Number of execution phases (trips to DBMS to populate
033     *   cache)
034     * @param state State; indicates reason why execution terminated
035     * @param cellCacheHitCount Number of cell requests for which cell was
036     *   already in cache
037     * @param cellCacheMissCount Number of cell requests for which cell was
038     *   not in cache
039     * @param cellCachePendingCount Number of cell requests for which cell was
040     */
041    public ExecutionEndEvent(
042        long timestamp,
043        int serverId,
044        int connectionId,
045        long statementId,
046        long executionId,
047        int phaseCount,
048        Execution.State state,
049        int cellCacheHitCount,
050        int cellCacheMissCount,
051        int cellCachePendingCount)
052    {
053        super(timestamp, serverId, connectionId, statementId, executionId);
054        this.phaseCount = phaseCount;
055        this.state = state;
056        this.cellCacheHitCount = cellCacheHitCount;
057        this.cellCacheMissCount = cellCacheMissCount;
058        this.cellCachePendingCount = cellCachePendingCount;
059    }
060
061    @Override
062    public String toString() {
063        return "ExecutionEndEvent(" + executionId + ")";
064    }
065
066    public <T> T accept(Visitor<T> visitor) {
067        return visitor.visit(this);
068    }
069}
070
071// End ExecutionEndEvent.java