Class CallContext

    • Field Detail

      • MAX_DATA_ACCESSORS

        public static final int MAX_DATA_ACCESSORS
        Maximal number of accessors that can be opened within single context.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CallContext

        public CallContext​(String userId)
        Creates new not activated context.
        Parameters:
        userId - User identifier. Cannot be null or empty.
      • CallContext

        public CallContext​(String userId,
                           ICelesta celesta,
                           String procName)
        Creates activated context.
        Parameters:
        userId - User identifier. Cannot be null or empty.
        celesta - Celesta instance.
        procName - Procedure which is being called in this context.
    • Method Detail

      • activate

        public void activate​(ICelesta celesta,
                             String procName)
        Activates CallContext with 'live' Celesta and procName.
        Parameters:
        celesta - Celesta to use CallContext with.
        procName - Name of the called procedure (for logging/audit needs).
      • getUserId

        public String getUserId()
        Returns name of the current user.
        Returns:
      • commit

        public void commit()
        Commits the current transaction. Will cause error for not-activated or closed context.

        Wraps SQLException into CelestaException.

      • rollback

        public void rollback()
        Rollbacks the current transaction. Does nothing for not-activated context.

        Wraps SQLException into CelestaException.

      • getCelesta

        public ICelesta getCelesta()
        Returns Celesta instance.
        Returns:
        null for not activated context
      • getScore

        public Score getScore()
        Returns score of current Celesta instance.
        Specified by:
        getScore in interface ICallContext
        Returns:
      • setLastDataAccessor

        public void setLastDataAccessor​(BasicDataAccessor dataAccessor)
        Set the last data accessor object.
        Parameters:
        dataAccessor - data accessor object
      • incDataAccessorsCount

        public void incDataAccessorsCount()
        Increments counter of open data accessor objects.
        Throws:
        CelestaException - if the maximal limit of data accessors is exceeded.
      • decDataAccessorsCount

        public void decDataAccessorsCount()
        Decrements counter of open data accessor objects.
      • getLastDataAccessor

        public BasicDataAccessor getLastDataAccessor()
        Returns the last data accessor object.
        Returns:
      • getDBPid

        public int getDBPid()
        Returns Process Id of current connection to the database.
        Returns:
      • getProcName

        public String getProcName()
        Returns procedure name that was initially called.
        Returns:
      • getStartTime

        public Date getStartTime()
        Returns the calendar date of CallContext activation.
        Returns:
      • getDurationNs

        public long getDurationNs()
        Returns number of nanoseconds since CallContext activation.
        Returns:
      • isClosed

        public boolean isClosed()
        If this context is closed.
        Specified by:
        isClosed in interface ICallContext
        Returns:
      • getCopy

        public CallContext getCopy()
        Duplicates callcontext with another JDBC connection.
        Returns: