org.axonframework.saga.annotation
Class AsyncSagaCreationElector

java.lang.Object
  extended by org.axonframework.saga.annotation.AsyncSagaCreationElector

public class AsyncSagaCreationElector
extends Object

Manages the election of which asynchronous saga event processor is responsible for creating a new Saga instance, when necessary.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
AsyncSagaCreationElector()
           
 
Method Summary
 void clear()
          Clears the voting counts for a new round.
 boolean waitForSagaCreationVote(boolean didInvocation, int totalVotesExpected, boolean isSagaOwner)
          Forces the current thread to wait for the voting to complete if it is responsible for creating the Saga.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncSagaCreationElector

public AsyncSagaCreationElector()
Method Detail

waitForSagaCreationVote

public boolean waitForSagaCreationVote(boolean didInvocation,
                                       int totalVotesExpected,
                                       boolean isSagaOwner)
Forces the current thread to wait for the voting to complete if it is responsible for creating the Saga. As soon as an invocation has been recorded, the waiting thread is released.

Parameters:
didInvocation - indicates whether the current processor found a Saga to process
totalVotesExpected - The total number of processors expected to cast a vote
isSagaOwner - Indicates whether the current processor "owns" the to-be-created saga instance.
Returns:
true if the current processor should create the new instance, false otherwise.

clear

public void clear()
Clears the voting counts for a new round.



Copyright © 2010-2016. All Rights Reserved.