org.axonframework.repository
Class ConflictingAggregateVersionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.axonframework.common.AxonException
                  extended by org.axonframework.common.AxonNonTransientException
                      extended by org.axonframework.repository.ConflictingModificationException
                          extended by org.axonframework.repository.ConflictingAggregateVersionException
All Implemented Interfaces:
Serializable

public class ConflictingAggregateVersionException
extends ConflictingModificationException

Exception indicating that the (actual) version of a loaded aggregate did not match the given expected version number. This typically means that the aggregate has been modified by another thread between the moment data was queried, and the command modifying the aggregate was handled.

Since:
0.6
Author:
Allard Buijze
See Also:
Serialized Form

Constructor Summary
ConflictingAggregateVersionException(Object aggregateIdentifier, long expectedVersion, long actualVersion)
          Initializes the exception using the given message.
ConflictingAggregateVersionException(Object aggregateIdentifier, long expectedVersion, long actualVersion, Throwable cause)
          Initializes the exception using the given message and cause.
 
Method Summary
 long getActualVersion()
          Returns the actual version of the aggregate, as loaded by the repository.
 Object getAggregateIdentifier()
          Returns the identifier of the aggregate which version is not as expected.
 long getExpectedVersion()
          Returns the version expected by the component loading the aggregate.
 
Methods inherited from class org.axonframework.common.AxonNonTransientException
isCauseOf
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConflictingAggregateVersionException

public ConflictingAggregateVersionException(Object aggregateIdentifier,
                                            long expectedVersion,
                                            long actualVersion)
Initializes the exception using the given message.

Parameters:
aggregateIdentifier - The identifier of the aggregate which version was not as expected
expectedVersion - The version expected by the component loading the aggregate
actualVersion - The actual version of the aggregate

ConflictingAggregateVersionException

public ConflictingAggregateVersionException(Object aggregateIdentifier,
                                            long expectedVersion,
                                            long actualVersion,
                                            Throwable cause)
Initializes the exception using the given message and cause.

Parameters:
aggregateIdentifier - The identifier of the aggregate which version was not as expected
expectedVersion - The version expected by the component loading the aggregate
actualVersion - The actual version of the aggregate
cause - The underlying cause of the exception
Method Detail

getAggregateIdentifier

public Object getAggregateIdentifier()
Returns the identifier of the aggregate which version is not as expected.

Returns:
the identifier of the aggregate which version is not as expected

getExpectedVersion

public long getExpectedVersion()
Returns the version expected by the component loading the aggregate.

Returns:
the version expected by the component loading the aggregate

getActualVersion

public long getActualVersion()
Returns the actual version of the aggregate, as loaded by the repository.

Returns:
the actual version of the aggregate


Copyright © 2010-2016. All Rights Reserved.