Package bitronix.tm.twopc.executor

Examples of bitronix.tm.twopc.executor.Job


            if (!isParticipating(resourceHolderState)) {
                if (log.isDebugEnabled()) log.debug("skipping not participating resource " + resourceHolderState);
                continue;
            }

            Job job = createJob(resourceHolderState);
            Object future = executor.submit(job);
            job.setFuture(future);
            jobs.add(job);
        }

        // wait for threads to finish and check results
        for (int i = 0; i < jobs.size(); i++) {
            Job job = (Job) jobs.get(i);

            Object future = job.getFuture();
            while (!executor.isDone(future)) {
                executor.waitFor(future, 1000L);
            }

            XAException xaException = job.getXAException();
            RuntimeException runtimeException = job.getRuntimeException();

            if (xaException != null) {
                if (log.isDebugEnabled()) log.debug("error executing " + job + ", errorCode=" + Decoder.decodeXAExceptionErrorCode(xaException));
                exceptions.add(xaException);
                errorResources.add(job.getResource());
            } else if (runtimeException != null) {
                if (log.isDebugEnabled()) log.debug("error executing " + job);
                exceptions.add(runtimeException);
                errorResources.add(job.getResource());
            }
        }

        if (log.isDebugEnabled()) log.debug("phase executed with " + exceptions.size() + " exception(s)");
        return new JobsExecutionReport(exceptions, errorResources);
View Full Code Here


            if (!isParticipating(resource)) {
                if (log.isDebugEnabled()) { log.debug("skipping not participating resource " + resource); }
                continue;
            }

            Job job = createJob(resource);
            Object future = executor.submit(job);
            job.setFuture(future);
            jobs.add(job);
        }

        // wait for threads to finish and check results
        for (Job job : jobs) {
            Object future = job.getFuture();
            while (!executor.isDone(future)) {
                executor.waitFor(future, 1000L);
            }

            XAException xaException = job.getXAException();
            RuntimeException runtimeException = job.getRuntimeException();

            if (xaException != null) {
                String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(xaException);
                if (log.isDebugEnabled()) { log.debug("error executing " + job + ", errorCode=" + Decoder.decodeXAExceptionErrorCode(xaException) +
                        (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails)); }
                exceptions.add(xaException);
                errorResources.add(job.getResource());
            } else if (runtimeException != null) {
                if (log.isDebugEnabled()) { log.debug("error executing " + job); }
                exceptions.add(runtimeException);
                errorResources.add(job.getResource());
            }
        }

        if (log.isDebugEnabled()) { log.debug("phase executed with " + exceptions.size() + " exception(s)"); }
        return new JobsExecutionReport(exceptions, errorResources);
View Full Code Here

TOP

Related Classes of bitronix.tm.twopc.executor.Job

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.