SHOW:
|
|
- or go back to the newest paste.
1 | - | HTable table = new HTable(config, "test3"); |
1 | + | HTable table = new HTable(config, "test3"); |
2 | - | |
2 | + | |
3 | - | for (int iteration = 0; iteration < 10; iteration++) |
3 | + | for (int iteration = 0; iteration < 10; iteration++) |
4 | - | { |
4 | + | { |
5 | - | |
5 | + | |
6 | - | final int linesToRead = 1000; |
6 | + | final int linesToRead = 1000; |
7 | - | System.out.println(new java.util.Date () + " Processing iteration " + iteration + "... "); |
7 | + | System.out.println(new java.util.Date () + " Processing iteration " + iteration + "... "); |
8 | - | Vector<Get> gets = new Vector<Get>(linesToRead); |
8 | + | Vector<Get> gets = new Vector<Get>(linesToRead); |
9 | ||
10 | - | for (long l = 0; l < linesToRead; l++) |
10 | + | for (long l = 0; l < linesToRead; l++) |
11 | - | { |
11 | + | { |
12 | - | byte[] array1 = new byte[24]; |
12 | + | byte[] array1 = new byte[24]; |
13 | - | for (int i = 0; i < array1.length; i++) |
13 | + | for (int i = 0; i < array1.length; i++) |
14 | - | array1[i] = (byte)Math.floor(Math.random() * 256); |
14 | + | array1[i] = (byte)Math.floor(Math.random() * 256); |
15 | - | Get g = new Get (array1); |
15 | + | Get g = new Get (array1); |
16 | - | gets.addElement(g); |
16 | + | gets.addElement(g); |
17 | ||
18 | - | processed++; |
18 | + | processed++; |
19 | - | } |
19 | + | } |
20 | - | Object[] results = new Object[gets.size()]; |
20 | + | Object[] results = new Object[gets.size()]; |
21 | - | |
21 | + | |
22 | - | long timeBefore = System.currentTimeMillis(); |
22 | + | long timeBefore = System.currentTimeMillis(); |
23 | - | table.batch(gets, results); |
23 | + | table.batch(gets, results); |
24 | - | long timeAfter = System.currentTimeMillis(); |
24 | + | long timeAfter = System.currentTimeMillis(); |
25 | ||
26 | - | float duration = timeAfter - timeBefore; |
26 | + | float duration = timeAfter - timeBefore; |
27 | - | System.out.println ("Time to read " + gets.size() + " lines : " + duration + " mseconds (" + Math.round(((float)linesToRead / (duration / 1000))) + " lines/seconds)"); |
27 | + | System.out.println ("Time to read " + gets.size() + " lines : " + duration + " mseconds (" + Math.round(((float)linesToRead / (duration / 1000))) + " lines/seconds)"); |
28 | ||
29 | ||
30 | - | for (int i = 0; i < results.length; i++) |
30 | + | for (int i = 0; i < results.length; i++) |
31 | - | { |
31 | + | { |
32 | - | if (results[i] instanceof KeyValue) |
32 | + | if (results[i] instanceof KeyValue) |
33 | - | if (!((KeyValue)results[i]).isEmptyColumn()) |
33 | + | if (!((KeyValue)results[i]).isEmptyColumn()) |
34 | - | System.out.println("Result[" + i + "]: " + results[i]); // co BatchExample-9-Dump Print all results. |
34 | + | System.out.println("Result[" + i + "]: " + results[i]); // co BatchExample-9-Dump Print all results. |
35 | - | } |
35 | + | } |