Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTable table = new HTable(config, "test3");
- for (int iteration = 0; iteration < 10; iteration++)
- {
- final int linesToRead = 1000;
- System.out.println(new java.util.Date () + " Processing iteration " + iteration + "... ");
- Vector<Get> gets = new Vector<Get>(linesToRead);
- for (long l = 0; l < linesToRead; l++)
- {
- byte[] array1 = new byte[24];
- for (int i = 0; i < array1.length; i++)
- array1[i] = (byte)Math.floor(Math.random() * 256);
- Get g = new Get (array1);
- gets.addElement(g);
- processed++;
- }
- Object[] results = new Object[gets.size()];
- long timeBefore = System.currentTimeMillis();
- table.batch(gets, results);
- long timeAfter = System.currentTimeMillis();
- float duration = timeAfter - timeBefore;
- System.out.println ("Time to read " + gets.size() + " lines : " + duration + " mseconds (" + Math.round(((float)linesToRead / (duration / 1000))) + " lines/seconds)");
- for (int i = 0; i < results.length; i++)
- {
- if (results[i] instanceof KeyValue)
- if (!((KeyValue)results[i]).isEmptyColumn())
- System.out.println("Result[" + i + "]: " + results[i]); // co BatchExample-9-Dump Print all results.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement