Examples of InstanceContext


Examples of org.apache.geronimo.transaction.InstanceContext

        TransactionContext transactionContext = transactionContextManager.getContext();
        if (transactionContext == null) {
            transactionContextManager.newUnspecifiedTransactionContext();
        }
        try {
            InstanceContext oldInstanceContext = trackedConnectionAssociator.enter(newInstanceContext);
            try {
                return next.invoke(newInstanceContext);
            } finally {
                trackedConnectionAssociator.exit(oldInstanceContext);
            }
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

        associatedContexts.remove(context.getContainerId(), context.getId());
        context.unassociate();
    }

    public final void unassociate(Object containerId, Object id) throws Throwable {
        InstanceContext context = (InstanceContext) associatedContexts.remove(containerId, id);
        if (context != null) {
            context.unassociate();
        }
    }
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

    }

    protected final void unassociateAll() {
        ArrayList toFlush = getAssociatedContexts();
        for (Iterator i = toFlush.iterator(); i.hasNext();) {
            InstanceContext context = (InstanceContext) i.next();
            try {
                context.unassociate();
            } catch (Throwable throwable) {
                log.warn("Error while unassociating instance from transaction context: " + context, throwable);
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

        if (context.getId() != null) {
            associate(context);
            dirtyContexts.put(context.getContainerId(), context.getId(), context);
        }
        context.enter();
        InstanceContext caller = currentContext;
        currentContext = context;
        return caller;
    }
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

    public final void flushState() throws Throwable {
        while (dirtyContexts.isEmpty() == false) {
            ArrayList toFlush = new ArrayList(dirtyContexts.values());
            dirtyContexts.clear();
            for (Iterator i = toFlush.iterator(); i.hasNext();) {
                InstanceContext context = (InstanceContext) i.next();
                if (!context.isDead()) {
                    context.flush();
                }
            }
        }
        if (currentContext != null && currentContext.getId() != null) {
            dirtyContexts.put(currentContext.getContainerId(), currentContext.getId(), currentContext);
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

    private void beforeCommit() throws Throwable {
        // @todo allow for enrollment during pre-commit
        ArrayList toFlush = getAssociatedContexts();
        for (Iterator i = toFlush.iterator(); i.hasNext();) {
            InstanceContext context = (InstanceContext) i.next();
            if (!context.isDead()) {
                context.beforeCommit();
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.transaction.InstanceContext

    private void afterCommit(boolean status) throws Throwable {
        Throwable firstThrowable = null;
        ArrayList toFlush = getAssociatedContexts();
        for (Iterator i = toFlush.iterator(); i.hasNext();) {
            InstanceContext context = (InstanceContext) i.next();
            if (!context.isDead()) {
                try {
                    context.afterCommit(status);
                } catch (Throwable e) {
                    if (firstThrowable == null) {
                        firstThrowable = e;
                    }
                }
View Full Code Here

Examples of org.apache.openejb.core.InstanceContext

            }
            finally{
                EjbTransactionUtil.afterInvoke(transactionPolicy, callContext);
            }

            return new InstanceContext(this, beanInstance, interceptorInstances, creationalContext);
        } finally {
            ThreadContext.exit(oldContext);
        }                       
    }
View Full Code Here

Examples of org.apache.openejb.core.InstanceContext

    private Instance ceateInstance(ThreadContext callContext, BeanContext beanContext) throws org.apache.openejb.ApplicationException {

        try {

            final InstanceContext context = beanContext.newInstance();

            if (context.getBean() instanceof SessionBean){

                final Operation originalOperation = callContext.getCurrentOperation();
                try {
                    callContext.setCurrentOperation(Operation.CREATE);
                    final Method create = beanContext.getCreateMethod();
                    final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap());
                    ejbCreate.invoke();
                } finally {
                    callContext.setCurrentOperation(originalOperation);
                }
            }

            return new Instance(context.getBean(), context.getInterceptors(), context.getCreationalContext());
        } catch (Throwable e) {
            if (e instanceof InvocationTargetException) {
                e = ((InvocationTargetException) e).getTargetException();
            }
            String t = "The bean instance " + beanContext.getDeploymentID() + " threw a system exception:" + e;
View Full Code Here

Examples of org.apache.openejb.core.InstanceContext

            Instance instance = null;
            try {
                // Create new instance

                try {
                    final InstanceContext context = beanContext.newInstance();

                    // Wrap-up everthing into a object
                    instance = new Instance(beanContext, primaryKey, context.getBean(), context.getInterceptors(), context.getCreationalContext(), entityManagers);

                } catch (Throwable throwable) {
                    ThreadContext callContext = ThreadContext.getThreadContext();
                    handleSystemException(callContext.getTransactionPolicy(), throwable, callContext);
                    throw new IllegalStateException(throwable); // should never be reached
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.