Example #1
0
 /** @brief Check if it's time to save the auctions out yet. */
 private void checkSnapshot() {
   if ((mLastCheckpointed + mCheckpointFrequency) < System.currentTimeMillis()) {
     mLastCheckpointed = System.currentTimeMillis();
     saveAuctions();
     System.gc();
   }
 }
Example #2
0
  /** @brief AuctionsManager is a singleton, there should only be one in the system. */
  private AuctionsManager() {
    //  This should be loaded from the configuration settings.
    mCheckpointFrequency = 10 * Constants.ONE_MINUTE;
    mLastCheckpointed = System.currentTimeMillis();

    mFilter = FilterManager.getInstance();
  }
Example #3
0
  public int clearDeleted() {
    int rval = DeletedEntry.clear();

    saveAuctions();
    System.gc();

    return rval;
  }
Example #4
0
  private static String makeBackupFilename(String filename, String toInsert) {
    int lastSlash = filename.lastIndexOf(System.getProperty("file.separator"));
    if (lastSlash == -1) {
      JConfig.log().logDebug("Filename has no separators: " + filename);
      lastSlash = 0;
    }
    int firstDot = filename.indexOf('.', lastSlash);
    if (firstDot == -1) {
      JConfig.log().logDebug("Filename has no dot/extension: " + filename);
      firstDot = filename.length();
    }

    return filename.substring(0, firstDot) + '-' + toInsert + filename.substring(firstDot);
  }