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-2012 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.server.monitor;
011
012import mondrian.olap.CacheControl;
013
014/**
015 * Event concerning the cell cache.
016 */
017public abstract class CellCacheEvent extends ExecutionEvent {
018
019    public final Source source;
020
021    /**
022     * Creates a CellCacheEvent.
023     * @param timestamp Timestamp of the event.
024     * @param serverId Server ID from which originated the event.
025     * @param connectionId Connection ID from which originated the event.
026     * @param statementId Statement ID from which originated the event.
027     * @param executionId Execution ID from which originated the event.
028     * @param source The source of the event, being a value of Source.
029     */
030    public CellCacheEvent(
031        long timestamp,
032        int serverId,
033        int connectionId,
034        long statementId,
035        long executionId,
036        Source source)
037    {
038        super(timestamp, serverId, connectionId, statementId, executionId);
039        this.source = source;
040    }
041
042    /**
043     * Enumeration of sources of a cell cache segment.
044     */
045    public enum Source {
046        /**
047         * A segment that is placed into the cache by an external cache.
048         *
049         * <p>Some caches (e.g. memcached) never generate this kind of
050         * event.</p>
051         *
052         * <p>In JBoss Infinispan, one scenario that causes this kind of event
053         * is as follows. A user issues an MDX query against a different
054         * Mondrian node in the same Infinispan cluster. To resolve missing
055         * cells, that node issues a SQL statement to load a segment. Infinispan
056         * propagates that segment to its peers, and each peer is notified that
057         * an "external segment" is now in the cache.</p>
058         */
059        EXTERNAL,
060
061        /**
062         * A segment that has been loaded in response to a user query,
063         * and populated by generating and executing a SQL statement.
064         */
065        SQL,
066
067        /**
068         * a segment that has been loaded in response to a user query,
069         * and populated by rolling up existing cache segments.
070         */
071        ROLLUP,
072
073        /**
074         * a segment that has been deleted by a call through
075         * the {@link CacheControl} API.
076         */
077        CACHE_CONTROL,
078    }
079}
080
081// End CellCacheEvent.java