Class OptimizerTracer

  • All Implemented Interfaces:
    OptionalTool

    public class OptimizerTracer
    extends java.lang.Object
    implements OptionalTool

    OptionalTool for tracing the Optimizer.

    • Constructor Summary

      Constructors 
      Constructor Description
      OptimizerTracer()
      0-arg constructor required by the OptionalTool contract
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.sql.SQLException cantInstantiate​(java.lang.String className)  
      private static Context getContext​(java.lang.String contextID)
      Privileged lookup of a Context.
      void loadTool​(java.lang.String... configurationParameters)
      Turns on optimizer tracing.
      void unloadTool​(java.lang.String... configurationParameters)
      Print the optimizer trace and turn off tracing.
      private java.sql.SQLException wrap​(java.lang.String errorMessage)  
      private java.sql.SQLException wrap​(java.lang.Throwable t)
      Wrap an exception in a SQLException
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OptimizerTracer

        public OptimizerTracer()
        0-arg constructor required by the OptionalTool contract
    • Method Detail

      • loadTool

        public void loadTool​(java.lang.String... configurationParameters)
                      throws java.sql.SQLException

        Turns on optimizer tracing. May take optional parameters:

        • xml - If the first arg is the "xml" literal, then trace output will be formatted as xml.
        • custom, $class - If the first arg is the "custom" literal, then the next arg must be the name of a class which implements org.apache.derby.iapi.sql.compile.OptTrace and which has a 0-arg constructor. The 0-arg constructor is called and the resulting OptTrace object is plugged in to trace the optimizer.
        Specified by:
        loadTool in interface OptionalTool
        Throws:
        java.sql.SQLException
      • cantInstantiate

        private java.sql.SQLException cantInstantiate​(java.lang.String className)
      • unloadTool

        public void unloadTool​(java.lang.String... configurationParameters)
                        throws java.sql.SQLException

        Print the optimizer trace and turn off tracing. Takes optional parameters:

        • fileName - Where to write the optimizer trace. If omitted, the trace is written to System.out.
        Specified by:
        unloadTool in interface OptionalTool
        Throws:
        java.sql.SQLException
      • wrap

        private java.sql.SQLException wrap​(java.lang.Throwable t)
        Wrap an exception in a SQLException
      • wrap

        private java.sql.SQLException wrap​(java.lang.String errorMessage)
      • getContext

        private static Context getContext​(java.lang.String contextID)
        Privileged lookup of a Context. Must be private so that user code can't call this entry point.