Package org.apache.derby.iapi.services.context

Examples of org.apache.derby.iapi.services.context.ContextService


    /*
     * now we need to setup a context stack for the database creation work.
     * We assume the System boot process has created a context
     * manager already, but not that contexts we need are there.
     */
    ContextService csf = ContextService.getFactory();

    ContextManager cm = csf.getCurrentContextManager();
    if (SanityManager.DEBUG)
      SanityManager.ASSERT((cm != null), "Failed to get current ContextManager");

    // RESOLVE other non-StandardException errors.
    bootingTC = null;
View Full Code Here


     * as long as there is work to do. When the queue is exhausted, the method
     * will exit (the thread dies).
     */
    public void run() {
        final long runStart = System.currentTimeMillis();
        ContextService ctxService = null;
        // Implement the outer-level exception handling here.
        try {
            // DERBY-5088: Factory-call may fail.
            ctxService = ContextService.getFactory();
            ctxService.setCurrentContextManager(ctxMgr);
            processingLoop();
        } catch (ShutdownException se) {
            // The database is/has been shut down.
            // Log processing statistics and exit.
            trace(1, "swallowed shutdown exception: " + extractIstatInfo(se));
            stop();
            ctxMgr.cleanupOnError(se, db.isActive());
        } catch (RuntimeException re) {
            // DERBY-4037
            // Extended filtering of runtime exceptions during shutdown:
            //  o assertions raised by debug jars
            //  o runtime exceptions, like NPEs, raised by production jars -
            //    happens because the background thread interacts with store
            //    on a lower level
            if (!isShuttingDown()) {
                log(AS_BACKGROUND_TASK, null, re,
                        "runtime exception during normal operation");
                throw re;
            }
            trace(1, "swallowed runtime exception during shutdown: " +
                    extractIstatInfo(re));
        } finally {
            if (ctxService != null) {
                ctxService.resetCurrentContextManager(ctxMgr);
            }
            runTime += (System.currentTimeMillis() - runStart);
            trace(0, "worker thread exit");
        }
    }
View Full Code Here

            XAResourceManager rm = ra.getXAResourceManager();
            ContextManager inDoubtCM = rm.find(xid);
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
            ContextService csf = ContextService.getFactory();
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.commit(inDoubtCM, xid_im, onePhase);
               
                // close the connection/transaction since it can never
                // be used again.
                inDoubtCM.cleanupOnError(StandardException.closeException());
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se);
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        synchronized (tranState) {
View Full Code Here

           
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
           
            ContextService csf = ContextService.getFactory();
           
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.forget(inDoubtCM, xid_im);
               
                // close the connection/transaction since it can never be used again.
                inDoubtCM.cleanupOnError(StandardException.closeException());
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se);
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        throw new XAException(tranState.isPrepared
View Full Code Here

           
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
           
            ContextService csf = ContextService.getFactory();
           
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.rollback(inDoubtCM, xid_im);
               
                // close the connection/transaction since it can never be used again.
                inDoubtCM.cleanupOnError(StandardException.closeException());
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se);
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        synchronized (tranState) {
View Full Code Here

      if (SanityManager.DEBUG) {
        SanityManager.SET_DEBUG_STREAM(systemStreams.stream().getPrintWriter());
      }

      contextService = new ContextService();

      uuidFactory = (UUIDFactory) Monitor.startSystemModule("org.apache.derby.iapi.services.uuid.UUIDFactory");

            timerFactory = (TimerFactory)Monitor.startSystemModule("org.apache.derby.iapi.services.timer.TimerFactory");
           
View Full Code Here

            XAResourceManager rm = ra.getXAResourceManager();
            ContextManager inDoubtCM = rm.find(xid);
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
            ContextService csf = ContextService.getFactory();
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.commit(inDoubtCM, xid_im, onePhase);
               
                // close the connection/transaction since it can never
                // be used again. DERBY-4856 No extended diagnostic information needed.
                inDoubtCM.cleanupOnError(StandardException.closeException(),
                        false);
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se, con.isActive());
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        synchronized (tranState) {
View Full Code Here

           
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
           
            ContextService csf = ContextService.getFactory();
           
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.forget(inDoubtCM, xid_im);
               
                // close the connection/transaction since it can never be used again.
                inDoubtCM.cleanupOnError(StandardException.closeException(),
                        false);
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se, con.isActive());
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        throw new XAException(tranState.isPrepared
View Full Code Here

           
            // RM also does not know about this xid.
            if (inDoubtCM == null)
                throw new XAException(XAException.XAER_NOTA);
           
            ContextService csf = ContextService.getFactory();
           
            csf.setCurrentContextManager(inDoubtCM);
            try {
                rm.rollback(inDoubtCM, xid_im);
               
                // close the connection/transaction since it can never be used again.
                inDoubtCM.cleanupOnError(StandardException.closeException(),
                        false);
                return;
            } catch (StandardException se) {
                // The rm threw an exception, clean it up in the approprate
                // context.  There is no transactionResource to handle the
                // exception for us.
                inDoubtCM.cleanupOnError(se, con.isActive());
                throw wrapInXAException(se);
            } finally {
                csf.resetCurrentContextManager(inDoubtCM);
            }
           
        }
       
        synchronized (tranState) {
View Full Code Here

      if (SanityManager.DEBUG) {
        SanityManager.SET_DEBUG_STREAM(systemStreams.stream().getPrintWriter());
      }

      contextService = new ContextService();

      uuidFactory = (UUIDFactory) Monitor.startSystemModule("org.apache.derby.iapi.services.uuid.UUIDFactory");

            timerFactory = (TimerFactory)Monitor.startSystemModule("org.apache.derby.iapi.services.timer.TimerFactory");
    } catch (StandardException se) {
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.context.ContextService

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.