public Void call() throws Exception {
  byte[][] keys=new byte[nops][];
  byte[][] vals=new byte[nops][];
  if (r.nextDouble() <= insertRate) {
    for (int i=0; i < nops; i++) {
      keys[i]=nextKey();
      vals[i]=new byte[5];
      r.nextBytes(vals[i]);
    }
    lock.lock();
    try {
      ndx.submit(0,nops,keys,vals,BatchInsertConstructor.RETURN_NO_VALUES,null);
      if (groundTruth != null) {
        groundTruth.submit(0,nops,keys,vals,BatchInsertConstructor.RETURN_NO_VALUES,null);
      }
    }
  finally {
      lock.unlock();
    }
  }
 else {
    for (int i=0; i < nops; i++) {
      keys[i]=nextKey();
    }
    lock.lock();
    try {
      ndx.submit(0,nops,keys,null,BatchRemoveConstructor.RETURN_MUTATION_COUNT,null);
      if (groundTruth != null) {
        groundTruth.submit(0,nops,keys,null,BatchRemoveConstructor.RETURN_MUTATION_COUNT,null);
      }
    }
  finally {
      lock.unlock();
    }
  }
  return null;
}

public Void call ( ) throws Exception { byte [ ] [ ] keys = new byte [ nops ] [ ] ; byte [ ] [ ] vals = new byte [ nops ] [ ] ; if ( r . nextDouble ( ) <= insertRate ) { for ( int i = 0 ; i < nops ; i ++ ) { keys [ i ] = nextKey ( ) ; vals [ i ] = new byte [ 5 ] ; r . nextBytes ( vals [ i ] ) ; } lock . lock ( ) ; try { ndx . submit ( 0 , nops , keys , vals , BatchInsertConstructor . RETURN_NO_VALUES , null ) ; if ( groundTruth != null ) { groundTruth . submit ( 0 , nops , keys , vals , BatchInsertConstructor . RETURN_NO_VALUES , null ) ; } } finally { lock . unlock ( ) ; } } else { for ( int i = 0 ; i < nops ; i ++ ) { keys [ i ] = nextKey ( ) ; } lock . lock ( ) ; try { ndx . submit ( 0 , nops , keys , null , BatchRemoveConstructor . RETURN_MUTATION_COUNT , null ) ; if ( groundTruth != null ) { groundTruth . submit ( 0 , nops , keys , null , BatchRemoveConstructor . RETURN_MUTATION_COUNT , null ) ; } } finally { lock . unlock ( ) ; } } return null ; }
executes a random batch operation with keys presented in sorted order . < p > note : batch operations with sorted keys have twice the performance of the corresponding operation with unsorted keys due to improved locality of the lookups performed on the index .
