Package org.apache.derby.iapi.services.loader

Examples of org.apache.derby.iapi.services.loader.GeneratedClass


    {
      /* Has the activation class changed? */
      if (gc != ps.getActivationClass())
      {

                GeneratedClass newGC;

        // ensure the statement is valid by rePreparing it.
                // DERBY-3260: If someone else reprepares the statement at the
                // same time as we do, there's a window between the calls to
                // rePrepare() and getActivationClass() when the activation
                // class can be set to null, leading to NullPointerException
                // being thrown later. Therefore, synchronize on ps to close
                // the window.
                synchronized (ps) {
                    ps.rePrepare(getLanguageConnectionContext());
                    newGC = ps.getActivationClass();
                }

        /*
        ** If we get here, it means the PreparedStatement has been
        ** recompiled.  Get a new Activation and check whether the
        ** parameters are compatible.  If so, transfer the parameters
        ** from the old Activation to the new one, and make that the
        ** current Activation.  If not, throw an exception.
        */
        BaseActivation    newAC = (BaseActivation) newGC.newInstance(lcc);

        DataTypeDescriptor[]  newParamTypes = ps.getParameterTypes();

        /*
        ** Link the new activation to the prepared statement.
View Full Code Here


    generatingClass.finishConstructor();

    try {
      // cook the completed class into a real class
      // and stuff it into activationClass
      GeneratedClass activationClass = generatingClass.getGeneratedClass(byteCode);

      return activationClass;
    } catch (StandardException e) {
     
      String msgId = e.getMessageId();
View Full Code Here

                  boolean scrollable)
    throws StandardException
  {
    Activation ac;
    synchronized (this) {
      GeneratedClass gc = getActivationClass();

      if (gc == null) {
        rePrepare(lcc);
        gc = getActivationClass();
      }
View Full Code Here

    LanguageConnectionContext lcc =
      (LanguageConnectionContext) ContextService.getContext
                                          (LanguageConnectionContext.CONTEXT_ID);
    ClassFactory classFactory = lcc.getLanguageConnectionFactory().getClassFactory();

    GeneratedClass gc = classFactory.loadGeneratedClass(className, byteCode);

    /*
    ** No special try catch logic to write out bad classes
    ** here.  We don't expect any problems, and in any
    ** event, we don't have the class builder available
View Full Code Here

    LanguageConnectionContext lcc =
      (LanguageConnectionContext) ContextService.getContext
                                          (LanguageConnectionContext.CONTEXT_ID);
    ClassFactory classFactory = lcc.getLanguageConnectionFactory().getClassFactory();

    GeneratedClass gc = classFactory.loadGeneratedClass(className, byteCode);

    /*
    ** No special try catch logic to write out bad classes
    ** here.  We don't expect any problems, and in any
    ** event, we don't have the class builder available
View Full Code Here

            {
              throw StandardException.newException(SQLState.LANG_STOP_AFTER_OPTIMIZING);
            }
          }

          GeneratedClass ac = qt.generate(preparedStmt.getByteCodeSaver());

          generateTime = getCurrentTimeMillis(lcc);
          /* endTimestamp only meaningful if generateTime is meaningful.
           * generateTime is meaningful if STATISTICS TIMING is ON.
           */
 
View Full Code Here

            final boolean needNewClass =
                    gc == null || gc != ps.getActivationClass();
      if (needNewClass || !ac.isValid())
      {

                GeneratedClass newGC;

        if (needNewClass) {
                    // The statement has been re-prepared since the last time
                    // we executed it. Get the new activation class.
                    newGC = ps.getActivationClass();
                    if (newGC == null) {
                        // There is no class associated with the statement.
                        // Tell the caller that the statement needs to be
                        // recompiled.
                        throw StandardException.newException(
                                SQLState.LANG_STATEMENT_NEEDS_RECOMPILE);
                    }
        } else {
          // Reuse the generated class, we just want a new activation
          // since the old is no longer valid.
          newGC = gc;
        }


        /*
        ** If we get here, it means the Activation has been invalidated
        ** or the PreparedStatement has been recompiled.  Get a new
        ** Activation and check whether the parameters are compatible.
        ** If so, transfer the parameters from the old Activation to
        ** the new one, and make that the current Activation.  If not,
        ** throw an exception.
        */
        BaseActivation    newAC = (BaseActivation) newGC.newInstance(lcc);

        DataTypeDescriptor[]  newParamTypes = ps.getParameterTypes();

        /*
        ** Link the new activation to the prepared statement.
View Full Code Here

    GenericPreparedStatement ps = cs.getPreparedStatement();

    synchronized (ps) {
      if (ps.upToDate()) {
        GeneratedClass ac = ps.getActivationClass();

        // Check to see if the statement was prepared before some change
        // in the class loading set. If this is the case then force it to be invalid
        int currentClasses =
            getLanguageConnectionFactory().getClassFactory().getClassLoaderVersion();

        if (ac.getClassLoaderVersion() != currentClasses) {
          ps.makeInvalid(DependencyManager.INTERNAL_RECOMPILE_REQUEST, this);
        }

        // note that the PreparedStatement is not kept in the cache. This is because
        // having items kept in the cache that ultimately are held onto by
View Full Code Here

    // wrap up the constructor by putting a return at the end of it
    generatingClass.finishConstructor();

    // cook the completed class into a real class
    // and stuff it into activationClass
    GeneratedClass activationClass = generatingClass.getGeneratedClass(byteCode);

    return activationClass;
   }
View Full Code Here

        ** recompiled.  Get a new Activation and check whether the
        ** parameters are compatible.  If so, transfer the parameters
        ** from the old Activation to the new one, and make that the
        ** current Activation.  If not, throw an exception.
        */
        GeneratedClass    newGC = ps.getActivationClass();

        BaseActivation    newAC = (BaseActivation) newGC.newInstance(lcc);

        DataTypeDescriptor[]  newParamTypes = ps.getParameterTypes();

        /*
        ** Link the new activation to the prepared statement.
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.loader.GeneratedClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.