예제 #1
0
 /** If tracked offsets may be present, get them so they are ready to be written to the log. */
 private void getOffsets() {
   if (needOffsets) {
     long[] offsets = trackedSummary.getObsoleteOffsets();
     if (offsets != null) {
       int oldSize = obsoleteOffsets.getExtraMemorySize();
       obsoleteOffsets.pack(offsets);
       int newSize = obsoleteOffsets.getExtraMemorySize();
       memBudget.updateTreeMemoryUsage(newSize - oldSize);
     }
     needOffsets = false;
   }
 }
예제 #2
0
  /** @see LN#writeToLog */
  public void writeToLog(ByteBuffer logBuffer) {

    /*
     * Add the tracked (live) summary to the base summary before writing it
     * to the log, and reset the tracked summary.  Do this even when
     * deleting the LN, so that the tracked summary is cleared.
     */
    if (trackedSummary != null) {

      baseSummary.add(trackedSummary);

      if (!isDeleted()) {
        getOffsets();
      }

      /* Reset the totals to zero and clear the tracked offsets. */
      trackedSummary.reset();
    }

    super.writeToLog(logBuffer);

    if (!isDeleted()) {
      baseSummary.writeToLog(logBuffer);
      obsoleteOffsets.writeToLog(logBuffer);
    }
  }
예제 #3
0
 /**
  * Dump additional fields. Done this way so the additional info can be within the XML tags
  * defining the dumped log entry.
  */
 protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
   if (!isDeleted()) {
     baseSummary.dumpLog(sb, true);
     if (verbose) {
       obsoleteOffsets.dumpLog(sb, true);
     }
   }
 }
예제 #4
0
 /**
  * This log entry type is configured to perform marshaling (getLogSize and writeToLog) under the
  * write log mutex. Otherwise, the size could change in between calls to these two methods as the
  * result of utilizaton tracking.
  *
  * @see LN#getLogSize
  */
 public int getLogSize() {
   int size = super.getLogSize();
   if (!isDeleted()) {
     size += baseSummary.getLogSize();
     getOffsets();
     size += obsoleteOffsets.getLogSize();
   }
   return size;
 }
예제 #5
0
 public String dumpString(int nSpaces, boolean dumpTags) {
   StringBuffer sb = new StringBuffer();
   sb.append(super.dumpString(nSpaces, dumpTags));
   sb.append('\n');
   if (!isDeleted()) {
     sb.append(baseSummary.toString());
     sb.append(obsoleteOffsets.toString());
   }
   return sb.toString();
 }
예제 #6
0
  /** @see LN#readFromLog */
  public void readFromLog(ByteBuffer itemBuffer, byte entryVersion) throws LogException {

    this.entryVersion = entryVersion;

    super.readFromLog(itemBuffer, entryVersion);

    if (!isDeleted()) {
      baseSummary.readFromLog(itemBuffer, entryVersion);
      if (entryVersion > 0) {
        obsoleteOffsets.readFromLog(itemBuffer, entryVersion);
      }
    }
  }
예제 #7
0
 /** Overrides this method to add space occupied by this object's fields. */
 @Override
 public long getMemorySizeIncludedByParent() {
   return super.getMemorySizeIncludedByParent()
       + (MemoryBudget.FILESUMMARYLN_OVERHEAD - MemoryBudget.LN_OVERHEAD)
       + obsoleteOffsets.getExtraMemorySize();
 }