Package mondrian.server
Class Execution
- java.lang.Object
-
- mondrian.server.Execution
-
public class Execution extends Object
Execution context.Loosely corresponds to a CellSet. A given statement may be executed several times over its lifetime, but at most one execution can be going on at a time.
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Execution.State
Enumeration of the states of an Execution instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels the execution instance.void
cancelSqlStatements()
Called by the RolapResultShepherd when the execution needs to clean all of its resources for whatever reasons, typically when an exception has occurred or the execution has ended.void
checkCancelOrTimeout()
Checks the state of this Execution and throws an exception if something is wrong.void
end()
Called when query execution has completed.long
getElapsedMillis()
int
getExpCacheHitCount()
int
getExpCacheMissCount()
long
getId()
Statement
getMondrianStatement()
QueryTiming
getQueryTiming()
long
getStartTime()
boolean
isCancelOrTimeout()
Returns whether this execution is currently in a failed state and will throw an exception as soon as the next check is performed usingcheckCancelOrTimeout()
.boolean
isDone()
Tells whether this execution is done executing.void
registerStatement(Locus locus, Statement statement)
This method is typically called by SqlStatement at construction time.void
setCellCacheHitCount(int cellCacheHitCount)
void
setCellCacheMissCount(int cellCacheMissCount)
void
setCellCachePendingCount(int cellCachePendingCount)
void
setContextMap()
Set the copied mdc into the current MDC.void
setExpCacheCounts(int hitCount, int missCount)
void
setOutOfMemory(String msg)
This method will change the state of this execution toExecution.State.ERROR
and will set the message to display.void
start()
Marks the start of an Execution instance.void
tracePhase(int hitCount, int missCount, int pendingCount)
void
unregisterSegmentRequests()
Calls into the SegmentCacheManager and unregisters all the registrations made for this execution on segments form the index.
-
-
-
Field Detail
-
NONE
public static final Execution NONE
-
-
Constructor Detail
-
Execution
public Execution(Statement statement, long timeoutIntervalMillis)
-
-
Method Detail
-
setContextMap
public void setContextMap()
Set the copied mdc into the current MDC. This should be called any time there will be logging in a thread handled by the RolapResultShepherd where original MDC needs to be retrieved
-
start
public void start()
Marks the start of an Execution instance. It is called byStatement.start(Execution)
automatically. Users don't need to call this method.
-
tracePhase
public void tracePhase(int hitCount, int missCount, int pendingCount)
-
cancel
public void cancel()
Cancels the execution instance.
-
setOutOfMemory
public final void setOutOfMemory(String msg)
This method will change the state of this execution toExecution.State.ERROR
and will set the message to display. Cleanup of the resources used by this execution instance will be performed in the background later on.- Parameters:
msg
- The message to display to the user, describing the problem encountered with the memory space.
-
checkCancelOrTimeout
public void checkCancelOrTimeout() throws MondrianException
Checks the state of this Execution and throws an exception if something is wrong. This method should be called by the user thread.It won't throw anything if the query has successfully completed.
- Throws:
MondrianException
- The exception encountered.
-
isCancelOrTimeout
public boolean isCancelOrTimeout()
Returns whether this execution is currently in a failed state and will throw an exception as soon as the next check is performed usingcheckCancelOrTimeout()
.- Returns:
- True or false, depending on the timeout state.
-
isDone
public boolean isDone()
Tells whether this execution is done executing.
-
cancelSqlStatements
public void cancelSqlStatements()
Called by the RolapResultShepherd when the execution needs to clean all of its resources for whatever reasons, typically when an exception has occurred or the execution has ended. Any currently running SQL statements will be canceled. It should only be called ifisCancelOrTimeout()
returns true.This method doesn't need to be called by a user. It will be called internally by Mondrian when the system is ready to clean the remaining resources.
To check if this execution is failed, use
isCancelOrTimeout()
instead.
-
end
public void end()
Called when query execution has completed. Once query execution has ended, it is not possible to cancel or timeout the query until it starts executing again.
-
unregisterSegmentRequests
public void unregisterSegmentRequests()
Calls into the SegmentCacheManager and unregisters all the registrations made for this execution on segments form the index.
-
getStartTime
public final long getStartTime()
-
getMondrianStatement
public final Statement getMondrianStatement()
-
getQueryTiming
public final QueryTiming getQueryTiming()
-
getId
public final long getId()
-
getElapsedMillis
public final long getElapsedMillis()
-
registerStatement
public void registerStatement(Locus locus, Statement statement)
This method is typically called by SqlStatement at construction time. It ties all Statement objects to a particular Execution instance so that we can audit, monitor and gracefully cancel an execution.- Parameters:
statement
- The statement used by this execution.
-
setCellCacheHitCount
public void setCellCacheHitCount(int cellCacheHitCount)
-
setCellCacheMissCount
public void setCellCacheMissCount(int cellCacheMissCount)
-
setCellCachePendingCount
public void setCellCachePendingCount(int cellCachePendingCount)
-
setExpCacheCounts
public void setExpCacheCounts(int hitCount, int missCount)
-
getExpCacheHitCount
public int getExpCacheHitCount()
-
getExpCacheMissCount
public int getExpCacheMissCount()
-
-