Documentation of 'org.apache.derby.iapi.services.context.ContextService' Java class
ContextService
org.apache.derby.iapi.services.context

Class ContextService



  • public final class ContextService
    extends java.lang.Object
    A set of static methods to supply easier access to contexts.
    • Constructor Detail

      • ContextService

        public ContextService()
        Create a new ContextService for a Derby system. Only a single system is active at any time.
    • Method Detail

      • stop

        public static void stop()
        So it can be given to us and taken away...
      • getContext

        public static Context getContext(java.lang.String contextId)
        Find the context with the given name in the context service factory loaded for the system.
        Returns:
        The requested context, null if it doesn't exist.
      • getContextOrNull

        public static Context getContextOrNull(java.lang.String contextId)
        Find the context with the given name in the context service factory loaded for the system. This version will not do any debug checking, but return null quietly if it runs into any problems.
        Returns:
        The requested context, null if it doesn't exist.
      • getCurrentContextManager

        public ContextManager getCurrentContextManager()
        Get current Context Manager linked to the current Thread. See setCurrentContextManager for details. Note that this call can be expensive and is only intended to be used in "stateless" situations. Ideally code has a reference to the correct ContextManager from another Object, such as a pushed Context.
        Returns:
        ContextManager current Context Manager
      • resetCurrentContextManager

        public void resetCurrentContextManager(ContextManager cm)
        Break the link between the current Thread and the passed in ContextManager. Called in a pair with setCurrentContextManager, see that method for details.
      • setCurrentContextManager

        public void setCurrentContextManager(ContextManager cm)
        Link the current thread to the passed in Contextmanager so that a subsequent call to getCurrentContextManager by the current Thread will return cm. ContextManagers are tied to a Thread while the thread is executing Derby code. For example on most JDBC method calls the ContextManager backing the Connection object is tied to the current Thread at the start of the method and reset at the end of the method. Once the Thread has completed its Derby work the method resetCurrentContextManager must be called with the same ContextManager to break the link. Note that a subsquent use of the ContextManager may be on a separate Thread, the Thread is only linked to the ContextManager between the setCurrentContextManager and resetCurrentContextManager calls.
        ContextService supports nesting of calls by a single Thread, either with the same ContextManager or a different ContextManager.
        • The same ContextManager would be pushed during a nested JDBC call in a procedure or function.
        • A different ContextManager would be pushed during a call on a different embedded JDBC Connection in a procedure or function.
      • newContextManager

        public ContextManager newContextManager()
        It's up to the caller to track this context manager and set it in the context manager list using setCurrentContextManager. We don't keep track of it due to this call being made.
      • notifyAllActiveThreads

        public void notifyAllActiveThreads(Context c)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.