Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2010-2011. Axon Framework
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.axonframework.saga;
Executor that processes saga lookups and saga event handling using an java.util.concurrent.Executor. This allows processing of events by sagas to happen fully asynchronously from the event dispatching mechanism.

Allard Buijze
        extends AsynchronousExecutionWrapper<Runnableimplements SagaHandlerExecutor {

Initializes an AsynchronousSagaExecutor using the given executor and transactionManager. Note that the transaction manager is invoked for both the saga resolution process as well as the saga invocation process.

transactionManager The transaction manager that will manage underlying transactions
executor The executor that processes the tasks
    public AsynchronousSagaExecutor(Executor executorTransactionManager transactionManager) {
        super(executornew OneEventPerTransaction(transactionManager), new SequentialPolicy());
    public void scheduleLookupTask(Runnable task) {
    public void scheduleEventProcessingTask(Saga sagaRunnable task) {
        // it is unsafe to schedule Sagas completely concurrently, as association values might not be processed while
        // new events are arriving. To provide necessary ordering guarantees, all activity runs in a single thread.;
    protected void doHandle(Runnable task) {;
    private static class OneEventPerTransaction implements TransactionManager {
        private final TransactionManager delegate;
        public OneEventPerTransaction(
                TransactionManager transactionManager) {
             = transactionManager;
        public void beforeTransaction(TransactionStatus transactionStatus) {
        public void afterTransaction(TransactionStatus transactionStatus) {
New to GrepCode? Check out our FAQ X