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 just before Mondrian starts to execute a SQL statement.
016 */
017public class SqlStatementStartEvent extends SqlStatementEvent {
018    public final int cellRequestCount;
019
020    /**
021     * Creates a SqlStatementStartEvent.
022     *
023     * @param timestamp Timestamp
024     * @param sqlStatementId SQL Statement id
025     * @param locus Locus of event
026     * @param sql SQL
027     * @param purpose Why Mondrian is executing this statement
028     * @param cellRequestCount Number of missed cells that led to this request
029     */
030    public SqlStatementStartEvent(
031        long timestamp,
032        long sqlStatementId,
033        Locus locus,
034        String sql,
035        Purpose purpose,
036        int cellRequestCount)
037    {
038        super(timestamp, sqlStatementId, locus, sql, purpose);
039        this.cellRequestCount = cellRequestCount;
040    }
041
042    public String toString() {
043        return "SqlStatementStartEvent(" + sqlStatementId + ")";
044    }
045
046    public <T> T accept(Visitor<T> visitor) {
047        return visitor.visit(this);
048    }
049}
050
051// End SqlStatementStartEvent.java