public boolean doTransaction(DB db,Object threadstate) throws WorkloadException {
  boolean ret=true;
  long st=System.nanoTime();
  String op=operationchooser.nextString();
  if (op.compareTo("READ") == 0) {
    ret=doTransactionRead(db);
  }
 else   if (op.compareTo("UPDATE") == 0) {
    ret=doTransactionUpdate(db);
  }
 else   if (op.compareTo("INSERT") == 0) {
    ret=doTransactionInsert(db);
  }
 else   if (op.compareTo("SCAN") == 0) {
    ret=doTransactionScan(db);
  }
 else {
    ret=doTransactionReadModifyWrite(db);
  }
  long en=System.nanoTime();
  _measurements.measure(_operations.get(op),(int)((en - st) / 1000));
  if (ret)   _measurements.reportReturnCode(_operations.get(op),-1);
 else {
    _measurements.reportReturnCode(_operations.get(op),0);
  }
  return ret;
}

public boolean doTransaction ( DB db , Object threadstate ) throws WorkloadException { boolean ret = true ; long st = System . nanoTime ( ) ; String op = operationchooser . nextString ( ) ; if ( op . compareTo ( "READ" ) == 0 ) { ret = doTransactionRead ( db ) ; } else if ( op . compareTo ( "UPDATE" ) == 0 ) { ret = doTransactionUpdate ( db ) ; } else if ( op . compareTo ( "INSERT" ) == 0 ) { ret = doTransactionInsert ( db ) ; } else if ( op . compareTo ( "SCAN" ) == 0 ) { ret = doTransactionScan ( db ) ; } else { ret = doTransactionReadModifyWrite ( db ) ; } long en = System . nanoTime ( ) ; _measurements . measure ( _operations . get ( op ) , ( int ) ( ( en - st ) / 1000 ) ) ; if ( ret ) _measurements . reportReturnCode ( _operations . get ( op ) , - 1 ) ; else { _measurements . reportReturnCode ( _operations . get ( op ) , 0 ) ; } return ret ; }
do one transaction operation . because it will be called concurrently from multiple client threads , this function must be thread safe . however , avoid synchronized , or the threads will block waiting for each other , and it will be difficult to reach the target throughput . ideally , this function would have no side effects other than db operations .
