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.Locus;
013
014/**
015 * Event created when Mondrian finishes executing an SQL statement.
016 */
017public class SqlStatementEndEvent extends SqlStatementEvent {
018    public final long rowFetchCount;
019    public final boolean canceled;
020    public final Throwable throwable;
021
022    /**
023     * Creates a SqlStatementEndEvent.
024     *
025     * @param timestamp Timestamp
026     * @param sqlStatementId SQL statement id
027     * @param locus Locus of event
028     * @param sql SQL
029     * @param purpose Why Mondrian is executing this statement
030     * @param rowFetchCount Number of rows fetched
031     * @param canceled Whether statement was canceled
032     * @param throwable Throwable, or null if there was no error
033     */
034    public SqlStatementEndEvent(
035        long timestamp,
036        long sqlStatementId,
037        Locus locus,
038        String sql,
039        Purpose purpose,
040        long rowFetchCount,
041        boolean canceled,
042        Throwable throwable)
043    {
044        super(timestamp, sqlStatementId, locus, sql, purpose);
045        this.rowFetchCount = rowFetchCount;
046        this.canceled = canceled;
047        this.throwable = throwable;
048    }
049
050    public String toString() {
051        return "SqlStatementEndEvent(" + sqlStatementId + ")";
052    }
053
054    public <T> T accept(Visitor<T> visitor) {
055        return visitor.visit(this);
056    }
057}
058
059// End SqlStatementEndEvent.java