Skip to content

Commit

Permalink
Fix callout numbering.
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgeorge committed Nov 18, 2015
1 parent bd8b2d8 commit d4d3f3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions ch03/src/main/java/client/CheckAndPutExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ public static void main(String[] args) throws IOException {
// vv CheckAndPutExample
Put put1 = new Put(Bytes.toBytes("row1"));
put1.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
Bytes.toBytes("val1")); // co CheckAndPutExample-1-Put1 Create a new Put instance.
Bytes.toBytes("val1")); // co CheckAndPutExample-01-Put1 Create a new Put instance.

boolean res1 = table.checkAndPut(Bytes.toBytes("row1"),
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), null, put1); // co CheckAndPutExample-2-CAS1 Check if column does not exist and perform optional put operation.
System.out.println("Put 1a applied: " + res1); // co CheckAndPutExample-3-SOUT1 Print out the result, should be "Put 1a applied: true".
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), null, put1); // co CheckAndPutExample-02-CAS1 Check if column does not exist and perform optional put operation.
System.out.println("Put 1a applied: " + res1); // co CheckAndPutExample-03-SOUT1 Print out the result, should be "Put 1a applied: true".

boolean res2 = table.checkAndPut(Bytes.toBytes("row1"),
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), null, put1); // co CheckAndPutExample-4-CAS2 Attempt to store same cell again.
System.out.println("Put 1b applied: " + res2); // co CheckAndPutExample-5-SOUT2 Print out the result, should be "Put 1b applied: false" as the column now already exists.
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), null, put1); // co CheckAndPutExample-04-CAS2 Attempt to store same cell again.
System.out.println("Put 1b applied: " + res2); // co CheckAndPutExample-05-SOUT2 Print out the result, should be "Put 1b applied: false" as the column now already exists.

Put put2 = new Put(Bytes.toBytes("row1"));
put2.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
Bytes.toBytes("val2")); // co CheckAndPutExample-6-Put2 Create another Put instance, but using a different column qualifier.
Bytes.toBytes("val2")); // co CheckAndPutExample-06-Put2 Create another Put instance, but using a different column qualifier.

boolean res3 = table.checkAndPut(Bytes.toBytes("row1"),
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndPutExample-7-CAS3 Store new data only if the previous data has been saved.
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndPutExample-07-CAS3 Store new data only if the previous data has been saved.
Bytes.toBytes("val1"), put2);
System.out.println("Put 2 applied: " + res3); // co CheckAndPutExample-8-SOUT3 Print out the result, should be "Put 2 applied: true" as the checked column exists.
System.out.println("Put 2 applied: " + res3); // co CheckAndPutExample-08-SOUT3 Print out the result, should be "Put 2 applied: true" as the checked column exists.

Put put3 = new Put(Bytes.toBytes("row2"));
put3.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
Bytes.toBytes("val3")); // co CheckAndPutExample-9-Put3 Create yet another Put instance, but using a different row.
Bytes.toBytes("val3")); // co CheckAndPutExample-09-Put3 Create yet another Put instance, but using a different row.

boolean res4 = table.checkAndPut(Bytes.toBytes("row1"),
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndPutExample-a-CAS4 Store new data while checking a different row.
Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndPutExample-10-CAS4 Store new data while checking a different row.
Bytes.toBytes("val1"), put3);
System.out.println("Put 3 applied: " + res4); // co CheckAndPutExample-b-SOUT4 We will not get here as an exception is thrown beforehand!
System.out.println("Put 3 applied: " + res4); // co CheckAndPutExample-11-SOUT4 We will not get here as an exception is thrown beforehand!
// ^^ CheckAndPutExample
table.close();
connection.close();
Expand Down
2 changes: 1 addition & 1 deletion ch08/src/main/java/client/ScanConsistencyExample2.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void main(String[] args) throws IOException {
} catch (InterruptedException e) {
e.printStackTrace();
}
admin.split(tableName, Bytes.toBytes("row-3")); // co ScanConsistencyExample2-Split Split the table and wait until split operation has completed.
admin.split(tableName, Bytes.toBytes("row-3")); // co ScanConsistencyExample2-2-Split Split the table and wait until split operation has completed.
while (admin.getTableRegions(tableName).size() == 1) { }

// ^^ ScanConsistencyExample2
Expand Down

0 comments on commit d4d3f3a

Please sign in to comment.