Examples of DBCursor


Examples of com.sun.sgs.service.store.db.DbCursor

      int result;
      byte[] hashValue = classesDb.get(dbTxn, hashKey, false);
      if (hashValue != null) {
    result = DataEncoding.decodeInt(hashValue);
      } else {
    DbCursor cursor = classesDb.openCursor(dbTxn);
    try {
        result = cursor.findLast()
      ? getClassIdFromKey(cursor.getKey()) + 1 : 1;
        byte[] idKey = getKeyFromClassId(result);
        boolean success =
      cursor.putNoOverwrite(idKey, classInfo);
        if (!success) {
      throw new DataStoreException(
          "Class ID key already present");
        }
    } finally {
        cursor.close();
    }
    boolean success = classesDb.putNoOverwrite(
        dbTxn, hashKey, DataEncoding.encodeInt(result));
    if (!success) {
        throw new DataStoreException(
View Full Code Here

Examples of com.sun.sgs.service.store.db.DbCursor

     * @param  oid the object ID or -1
     * @return  the next object ID or -1
     */
    long nextObjectIdRaw(Transaction txn, long oid) {
  TxnInfo txnInfo = checkTxn(txn);
  DbCursor cursor = oidsDb.openCursor(txnInfo.dbTxn);
  try {
      boolean found =  (oid < 0)
    ? cursor.findFirst()
    : cursor.findNext(DataEncoding.encodeLong(oid + 1));
      if (found) {
    return DataEncoding.decodeLong(cursor.getKey());
      } else {
    return -1;
      }
  } finally {
      cursor.close();
  }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.