コード例 #1
0
  // Prepare the record for "friendship" table.
  // inviterid, inviteeid, status.
  private void addFriends(DB db, int dbKey, int keyNum) {
    int res = 0;
    // Generate the fields using StringByteIterator and RandomByteIterator.
    if (friendPercentage * (random.nextInt(userCount) + 1) >= 1.0f) {
      res = db.inviteFriend(dbKey, keyNum); // data = new StringByteIterator("1"); // Pending.
    } else {
      res = db.CreateFriendship(dbKey, keyNum); // data = new StringByteIterator("2"); // Already.
    }

    if (res < 0) {
      System.out.println(
          "The creation of the friendship relationship failes. "
              + "Please make sure the appropriate schema has been created "
              + " and the users have been inserted.");
      System.exit(-1);
    }
  }
コード例 #2
0
ファイル: TestDSClient.java プロジェクト: DavidBC/bg-scalaris
 /**
  * Cleanup any state for this DB.
  *
  * @param warmup This flag identifies if the thread calling it is in the warm up phase. In the
  *     warm up phase the threads do not issue updates, this phase can be used for warming up
  *     caches. If the warm up is set to true, the cache would not be restarted at the end of the
  *     warmup phase and only the warm up thread's connections to the database will be recycled.
  *     Called once per DB instance; there is one DB instance per client thread. This method should
  *     be called once the thread needs to end its communication with the data store. The code
  *     written for this function should close up the connection of the thread with the database
  *     and clean up the database instance.
  */
 @Override
 public void cleanup(boolean warmup) throws DBException {
   super.cleanup(warmup);
 }
コード例 #3
0
 @Override
 public HashMap<String, String> getDBInitialStats(DB db) {
   HashMap<String, String> stats = new HashMap<String, String>();
   stats = db.getInitialStats();
   return stats;
 }