org.multiverse.annotations
Annotation Type TransactionalMethod


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface TransactionalMethod

Annotation that can be added to a method and constructors to make them Transactional. A transactional method supports the following properties:

  1. A: failure Atomicity. All changes get in, or no changes get in
  2. C: Consistent. A TransactionalMethod can expect to enter memory in a valid state, and is expected when it leaves the space is consistent again.
  3. I: Isolated. A transaction will not observe changes made others transactions running in parallel. But it is going to see the changes made by transaction that completed earlier. If a transaction doesn't see this, the system could start to suffer from the lost update problem

Unfortunately @Inherited doesn't work for methods, only for classes. So if you have an interface containing some methods that need to be atomic, it needs to be added to the implementation and not to the interface. In the future Multiverse may try to this inference this.

When the readonly property is set to true, the transaction is not be able to do any updates and will throw a ReadonlyException.

With the retryCount the number of retries of the transaction can be controlled. For all kinds of reasons a transaction can fail, and these transactions can be retried because the next time they could succeed. An example of such a cause is optimistic locking the stm might use. The default number of retries is 1000.

Author:
Peter Veentjer

Optional Element Summary
 boolean interruptible
           
 int maxRetries
           
 boolean readonly
           
 long timeout
           
 java.util.concurrent.TimeUnit timeoutTimeUnit
           
 TraceLevel traceLevel
           
 boolean trackReads
           
 boolean writeSkew
           
 

trackReads

public abstract boolean trackReads
Default:
false

writeSkew

public abstract boolean writeSkew
Default:
true

interruptible

public abstract boolean interruptible
Default:
false

readonly

public abstract boolean readonly
Default:
false

maxRetries

public abstract int maxRetries
Default:
1000

timeout

public abstract long timeout
Default:
9223372036854775807L

timeoutTimeUnit

public abstract java.util.concurrent.TimeUnit timeoutTimeUnit
Default:
java.util.concurrent.TimeUnit.SECONDS

traceLevel

public abstract TraceLevel traceLevel
Default:
org.multiverse.api.TraceLevel.none


Copyright © 2008-2010 Multiverse. All Rights Reserved.