de.zib.scalaris.examples
Class TransactionReadWriteExample

java.lang.Object
  extended by de.zib.scalaris.examples.TransactionReadWriteExample

public class TransactionReadWriteExample
extends Object

Provides an example for using the read and write methods of the Transaction class together in one transaction.

Since:
2.0
Version:
2.0
Author:
Nico Kruber, kruber@zib.de

Constructor Summary
TransactionReadWriteExample()
           
 
Method Summary
static void main(String[] args)
          Implements the following transactions each with the Java type methods and the erlang (OTP) type methods.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionReadWriteExample

public TransactionReadWriteExample()
Method Detail

main

public static void main(String[] args)
Implements the following transactions each with the Java type methods and the erlang (OTP) type methods. The keys and values are given on the command line as "key1 value1 key2 value2 key3".
If no values are given, the default values (key1, value1) = ("key1", "value1"), (key2, value2) = ("key2", "value2") and key3 = "key3" are used.

Transaction 1:

write(key1, value1); write(key2, value2); result1 = read(key1); result2 = read(key2); result3 = read(key3); write(key3, result1 + result2); result3 = read(key3); commit();

Transaction 2:

write(key1, value1); commit(); write(key1, "WRONG value"); read(key1); abort(); read(key1); commit();

Parameters:
args - command line arguments with the structure "key1 value1 key2 value2 key3"
See Also:
Transaction1(String, String, String, String, String), Transaction2(String, String, String, String, String)