コード例 #1
0
  public synchronized CachedObject get(int i, PersistentStore store, boolean keep)
      throws HsqlException {

    if (i < 0) {
      return null;
    }

    try {
      CachedObject object = cache.get(i);

      if (object == null) {
        RowInputInterface rowInput = readObject(i);

        if (rowInput == null) {
          return null;
        }

        object = store.get(rowInput);

        // for text tables with empty rows at the beginning,
        // pos may move forward in readObject
        i = object.getPos();

        cache.put(i, object);
      }

      if (keep) {
        object.keepInMemory(true);
      }

      return object;
    } catch (IOException e) {
      database.logger.appLog.logContext(SimpleLog.LOG_ERROR, fileName + " get pos: " + i);
      database.logger.appLog.logContext(e);

      throw Trace.error(
          Trace.DATA_FILE_ERROR, Trace.DataFileCache_makeRow, new Object[] {e, fileName});
    }
  }
コード例 #2
0
  public synchronized CachedObject get(int i, PersistentStore store, boolean keep)
      throws HsqlException {

    if (i < 0) {
      return null;
    }

    try {
      CachedObject value = cache.get(i);

      if (value == null) {
        boolean result = readObject(i);

        if (!result) {
          return null;
        }

        value = store.get(rowIn);

        value.setPos(i);
        cache.put(i, value);
      }

      if (keep) {
        value.keepInMemory(true);
      }

      return value;
    } catch (IOException e) {
      database.logger.appLog.logContext("" + cache + " pos: " + i);
      database.logger.appLog.logContext(e);

      throw Trace.error(
          Trace.DATA_FILE_ERROR, Trace.DataFileCache_makeRow, new Object[] {e, fileName});
    }
  }