Skip to content

Commit

Permalink
more precise description on the read transaction example
Browse files Browse the repository at this point in the history
  • Loading branch information
mekjaer committed Aug 21, 2013
1 parent 408db43 commit f5d1895
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
3 changes: 2 additions & 1 deletion doc/ref/examples/GroupIntro.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ static void Assert(boolean check) {
throw new RuntimeException();
}
}
} //@@EndExample@@
}
//@@EndExample@@
18 changes: 8 additions & 10 deletions doc/ref/examples/ReadTransactionIntro.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,29 @@ public static void main(String[] args) {
//Get a table from the group
Table table = rt.getTable("table");

//Do all table read operations here
//Actions inside a ReadTransacton will never affect the original group and tables
String value = table.getString(1, 0);

//Do more table read operations here...

//-------------------------------------------------------------------
//ReadTransaction as a Group parameter in methods
//-------------------------------------------------------------------

//As a Transaction extends Group, it can be passed as a Group parameter
//A Transaction extends Group, and can be passed as a Group parameter
analyzeGroup(rt);

} finally {
//Always end the read transaction in a finally block, if something should go
//wrong inside the transaction. If it is not closed, a new transaction can not be initialized
//Always end the read transaction in a finally block. If the read-transaction is not
//closed, a new one cannot be started using the same SharedGroup instance.
rt.endRead();
}
}

private static void analyzeGroup(Group group){
String tableName = group.getTableName(0);
}// @@EndShow@@ //@@EndExample@@
} // @@EndShow@@

static void Assert(boolean check) {
if (!check) {
throw new RuntimeException();
}
}
}
}
//@@EndExample@@
3 changes: 2 additions & 1 deletion doc/ref/examples/SharedGroupIntro.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ static void Assert(boolean check) {
throw new RuntimeException();
}
}
} //@@EndExample@@
}
//@@EndExample@@
4 changes: 2 additions & 2 deletions doc/ref/examples/TableViewIntro.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ static void Assert(boolean check) {
throw new RuntimeException();
}
}

} //@@EndExample@@
}
//@@EndExample@@
3 changes: 2 additions & 1 deletion doc/ref/examples/WriteTransactionIntro.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ static void Assert(boolean check) {
throw new RuntimeException();
}
}
} //@@EndExample@@
}
//@@EndExample@@
3 changes: 1 addition & 2 deletions examples/ant-setup/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/bin
/bin

0 comments on commit f5d1895

Please sign in to comment.