Package org.apache.geronimo.transaction

Examples of org.apache.geronimo.transaction.InstanceContext


    protected void beforeCommit() throws Exception {
        // @todo allow for enrollment during pre-commit
        ArrayList toFlush = new ArrayList(associatedContexts.values());
        for (Iterator i = toFlush.iterator(); i.hasNext();) {
            InstanceContext context = (InstanceContext) i.next();
            context.beforeCommit();
        }
    }
View Full Code Here


    protected void afterCommit(boolean status) throws Exception {
        Throwable firstThrowable = null;
        ArrayList toFlush = new ArrayList(associatedContexts.values());
        for (Iterator i = toFlush.iterator(); i.hasNext();) {
            InstanceContext context = (InstanceContext) i.next();
            try {
                context.afterCommit(status);
            } catch (Throwable e) {
                if (firstThrowable == null) {
                    firstThrowable = e;
                }
            }
View Full Code Here

            throws HttpException, IOException {

        // save previous state
        ReadOnlyContext oldComponentContext = RootContext.getComponentContext();

        InstanceContext oldInstanceContext = null;

        try {
            // set up java:comp JNDI Context
            RootContext.setComponentContext(componentContext);
View Full Code Here

        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(classLoader);
            ReadOnlyContext oldComponentContext = RootContext.getComponentContext();
            InstanceContext oldInstanceContext = null;
            try {
                RootContext.setComponentContext(componentContext);
//TODO FIXME!!!
                TransactionContext transactionContext = transactionContextManager.getContext();
                if (transactionContext == null) {
View Full Code Here

        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(classLoader);
            ReadOnlyContext oldComponentContext = RootContext.getComponentContext();
            InstanceContext oldInstanceContext = null;
            try {
                RootContext.setComponentContext(componentContext);

                TransactionContext transactionContext = transactionContextManager.getContext();
                if (transactionContext == null) {
View Full Code Here

    private final ThreadLocal currentInstanceContexts = new ThreadLocal();
    private final ThreadLocal currentUnshareableResources = new ThreadLocal();

    public TrackedConnectionAssociator.ConnectorContextInfo enter(InstanceContext newInstanceContext, Set newUnshareableResources)
            throws ResourceException {
        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
        Set oldUnshareableResources = (Set)currentUnshareableResources.get();
        notifyConnections(newInstanceContext, newUnshareableResources);
        currentInstanceContexts.set(newInstanceContext);
        currentUnshareableResources.set(newUnshareableResources);
        return new TrackedConnectionAssociator.ConnectorContextInfo(oldInstanceContext, oldUnshareableResources);
View Full Code Here

            mcci.enter(connections, newUnshareableResources);
        }
    }

    public void newTransaction() throws ResourceException {
        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
        Set oldUnshareableResources = (Set)currentUnshareableResources.get();
        notifyConnections(oldInstanceContext, oldUnshareableResources);
    }
View Full Code Here

        notifyConnections(oldInstanceContext, oldUnshareableResources);
    }

    public void exit(ConnectorContextInfo reenteringConnectorContext)
            throws ResourceException {
        InstanceContext oldInstanceContext = (InstanceContext) currentInstanceContexts.get();
        Set oldUnshareableResources = (Set)currentUnshareableResources.get();
        Map resources = oldInstanceContext.getConnectionManagerMap();
        for (Iterator i = resources.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            ConnectionTrackingInterceptor mcci =
                    (ConnectionTrackingInterceptor) entry.getKey();
            Set connections = (Set) entry.getValue();
View Full Code Here


    public void handleObtained(
            ConnectionTrackingInterceptor connectionTrackingInterceptor,
            ConnectionInfo connectionInfo) {
        InstanceContext instanceContext = (InstanceContext) currentInstanceContexts.get();
        if (instanceContext == null) {
            return;
        }
        Map resources = instanceContext.getConnectionManagerMap();
        Set infos = (Set) resources.get(connectionTrackingInterceptor);
        if (infos == null) {
            infos = new HashSet();
            resources.put(connectionTrackingInterceptor, infos);
        }
View Full Code Here

    }

    public void handleReleased(
            ConnectionTrackingInterceptor connectionTrackingInterceptor,
            ConnectionInfo connectionInfo) {
        InstanceContext instanceContext = (InstanceContext) currentInstanceContexts.get();
        if (instanceContext == null) {
            return;
        }
        Map resources = instanceContext.getConnectionManagerMap();
        Set infos = (Set) resources.get(connectionTrackingInterceptor);
        //It's not at all clear that an equal ci will be supplied here
        infos.remove(connectionInfo);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.transaction.InstanceContext

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.