Class CommandContext

  • All Implemented Interfaces:
    Cloneable, CommandContext

    public class CommandContext
    extends Object
    implements Cloneable, CommandContext
    Defines the context that a command is processing in. For example, this defines who is processing the command and why. Also, this class (or subclasses) provide a means to pass context-specific information between users of the query processor framework.
    • Constructor Detail

      • CommandContext

        public CommandContext​(String connectionID,
                              String userName,
                              Serializable commandPayload,
                              String vdbName,
                              Object vdbVersion,
                              boolean collectNodeStatistics)
        Construct a new context.
      • CommandContext

        public CommandContext​(Object processorID,
                              String connectionID,
                              String userName,
                              String vdbName,
                              Object vdbVersion)
        Construct a new context.
      • CommandContext

        public CommandContext()
    • Method Detail

      • setWorkItem

        public void setWorkItem​(RequestWorkItem object)
        Parameters:
        object -
      • setNewVDBState

        public void setNewVDBState​(DQPWorkContext newWorkContext)
      • setConnectionID

        public void setConnectionID​(String connectionID)
        Sets the connectionID.
        Parameters:
        connectionID - The connectionID to set
      • setUserName

        public void setUserName​(String userName)
        Sets the userName.
        Parameters:
        userName - The userName to set
      • setVdbName

        public void setVdbName​(String vdbName)
        Sets the vdbName.
        Parameters:
        vdbName - The vdbName to set
      • setVdbVersion

        public void setVdbVersion​(Object vdbVersion)
        Sets the vdbVersion.
        Parameters:
        vdbVersion - The vdbVersion to set
      • setCommandPayload

        public void setCommandPayload​(Serializable commandPayload)
      • setCollectNodeStatistics

        public void setCollectNodeStatistics​(boolean collectNodeStatistics)
        Parameters:
        collectNodeStatistics - The collectNodeStatistics to set.
        Since:
        4.2
      • getCollectNodeStatistics

        public boolean getCollectNodeStatistics()
      • getProcessorBatchSize

        public int getProcessorBatchSize()
        Description copied from interface: CommandContext
        Get the processor batch size set on the BufferManager
        Specified by:
        getProcessorBatchSize in interface CommandContext
        Returns:
        - the nominal batch size target. actual batch sizes will vary based upon the column types
      • getProcessorBatchSize

        public int getProcessorBatchSize​(List<Expression> schema)
      • setProcessorBatchSize

        public void setProcessorBatchSize​(int processorBatchSize)
      • getCallStackDepth

        public int getCallStackDepth()
      • popCall

        public void popCall()
      • setAuthoriziationValidator

        public void setAuthoriziationValidator​(AuthorizationValidator authorizationValidator)
      • setTempTableStore

        public void setTempTableStore​(TempTableStore tempTableStore)
      • getSessionTempTableStore

        public TempTableStore getSessionTempTableStore()
      • setSessionTempTableStore

        public void setSessionTempTableStore​(TempTableStore tempTableStore)
      • setVariableContext

        public void setVariableContext​(VariableContext variableContext)
      • pushVariableContext

        public void pushVariableContext​(VariableContext toPush)
      • getTimeSliceEnd

        public long getTimeSliceEnd()
      • getTimeoutEnd

        public long getTimeoutEnd()
      • setTimeSliceEnd

        public void setTimeSliceEnd​(long timeSliceEnd)
      • setTimeoutEnd

        public void setTimeoutEnd​(long timeoutEnd)
      • setBufferManager

        public void setBufferManager​(BufferManager bm)
      • setGlobalTableStore

        public void setGlobalTableStore​(GlobalTableStore tempTableStore)
      • isNonBlocking

        public boolean isNonBlocking()
      • setNonBlocking

        public void setNonBlocking​(boolean nonBlocking)
      • isResultSetCacheEnabled

        public boolean isResultSetCacheEnabled()
      • setResultSetCacheEnabled

        public void setResultSetCacheEnabled​(boolean resultSetCacheEnabled)
      • getUserRequestSourceConcurrency

        public int getUserRequestSourceConcurrency()
      • setUserRequestSourceConcurrency

        public void setUserRequestSourceConcurrency​(int userRequestSourceConcurrency)
      • setSubject

        public void setSubject​(Subject subject)
      • accessedPlanningObject

        public void accessedPlanningObject​(Object id)
      • getPlanningObjects

        public Set<Object> getPlanningObjects()
      • accessedDataObject

        public void accessedDataObject​(Object id)
      • getDataObjects

        public Set<Object> getDataObjects()
      • setDataObjects

        public void setDataObjects​(HashSet<Object> dataObjectsAccessed)
      • setRequestId

        public void setRequestId​(RequestID requestId)
      • setDQPWorkContext

        public void setDQPWorkContext​(DQPWorkContext workContext)
      • setTransactionContext

        public void setTransactionContext​(TransactionContext transactionContext)
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
      • getExecutor

        public Executor getExecutor()
      • submit

        public <V> Future<V> submit​(Callable<V> callable)
        Submit work that will notify the request work item of more work when complete
        Parameters:
        callable -
        Returns:
      • setExecutor

        public void setExecutor​(Executor e)
      • close

        public void close()
      • incrementReuseCount

        public void incrementReuseCount()
      • isContinuous

        public boolean isContinuous()
        Specified by:
        isContinuous in interface CommandContext
        Returns:
        true if this is a continuous query
      • setContinuous

        public void setContinuous()
      • setVDBClassLoader

        public void setVDBClassLoader​(ClassLoader classLoader)
      • getAndClearWarnings

        public List<Exception> getAndClearWarnings()
        Get all warnings found while processing this plan. These warnings may be detected throughout the plan lifetime, which means new ones may arrive at any time. This method returns all current warnings and clears the current warnings list. The warnings are in order they were detected.
        Returns:
        Current list of warnings, never null
      • setTupleSourceCache

        public void setTupleSourceCache​(TupleSourceCache tupleSourceCache)
      • getOptions

        public Options getOptions()
      • setOptions

        public void setOptions​(Options options)
      • setReturnAutoGeneratedKeys

        public void setReturnAutoGeneratedKeys​(List<ElementSymbol> variables)
      • getReturnAutoGeneratedKeys

        public List<ElementSymbol> getReturnAutoGeneratedKeys()
      • getThreadLocalContext

        public static CommandContext getThreadLocalContext()
      • pushThreadLocalContext

        public static void pushThreadLocalContext​(CommandContext context)
      • popThreadLocalContext

        public static void popThreadLocalContext()
      • addAndGetReservedBuffers

        public long addAndGetReservedBuffers​(int i)
      • getConnection

        public TeiidConnection getConnection()
                                      throws TeiidSQLException
        Description copied from interface: CommandContext
        Gets a connection to the current session.
        WARNING be careful with blocking/recursive operations.
        The returned connection is considered to be derived and is not allowed to alter the transaction state or close the session.
        Each call to this method will return a new connection.
        Client side execution/connection properties are specific to each connection instance
        Specified by:
        getConnection in interface CommandContext
        Returns:
        a Connection to the current session
        Throws:
        TeiidSQLException
      • getSpatialRefSys

        public Clob getSpatialRefSys()
        Used by the system table logic
        Returns:
      • disableAutoCleanLobs

        public void disableAutoCleanLobs()
      • requestCancelled

        public void requestCancelled()
      • isCancelled

        public boolean isCancelled()
        Check if this context or the parent has been cancelled. If the parent has been, then we'll propagate.
        Returns:
      • clearGeneratedKeys

        public void clearGeneratedKeys()
      • getBatchUpdateException

        public Throwable getBatchUpdateException()
      • setBatchUpdateException

        public void setBatchUpdateException​(Throwable t)
      • isParallel

        public boolean isParallel()
      • setParallel

        public boolean setParallel​(boolean value)
      • currentDate

        public Date currentDate()
      • currentTime

        public Time currentTime()
      • currentTimestamp

        public Timestamp currentTimestamp()
      • setCurrentTimestamp

        public void setCurrentTimestamp​(long currentTimeMillis)
      • isAtomicBlock

        public boolean isAtomicBlock()
        Used by transaction detection logic when starting an atomic block transaction
        Returns:
      • setAtomicBlock

        public void setAtomicBlock​(boolean atomicBlock)
      • addAccessed

        public void addAccessed​(TempMetadataID id)
        Used by the planner to track only what is accessed by the plan
      • isReadOnly

        public boolean isReadOnly()
      • setReadOnly

        public void setReadOnly​(boolean b)