org.axonframework.repository
Enum LockingStrategy

java.lang.Object
  extended by java.lang.Enum<LockingStrategy>
      extended by org.axonframework.repository.LockingStrategy
All Implemented Interfaces:
Serializable, Comparable<LockingStrategy>

public enum LockingStrategy
extends Enum<LockingStrategy>

Enum indicating possible locking strategies for repositories.

Since:
0.3
Author:
Allard Buijze

Enum Constant Summary
NO_LOCKING
          Indicator of no locking strategy.
OPTIMISTIC
          Indicator of an optimistic locking strategy.
PESSIMISTIC
          Indicator of a pessimistic locking strategy.
 
Method Summary
static LockingStrategy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static LockingStrategy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

OPTIMISTIC

public static final LockingStrategy OPTIMISTIC
Indicator of an optimistic locking strategy. Concurrent access is not prevented. Instead, when concurrent modifications are detected, an exception is thrown.

See Also:
LockingRepository, ConcurrencyException

PESSIMISTIC

public static final LockingStrategy PESSIMISTIC
Indicator of a pessimistic locking strategy. This strategy will block any thread that tries to load an aggregate that has already been loaded by another thread. Once the other thread saves the aggregate, the lock is released, giving waiting threads the opportunity to obtain it and load the aggregate.

See Also:
LockingRepository

NO_LOCKING

public static final LockingStrategy NO_LOCKING
Indicator of no locking strategy. This strategy expects another mechanism to perform the necessary locking, such as an event store using a relational database.

Method Detail

values

public static LockingStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (LockingStrategy c : LockingStrategy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static LockingStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2011. All Rights Reserved.