Class DBTraceSnapshot

All Implemented Interfaces:
TraceSnapshot

public class DBTraceSnapshot extends DBAnnotatedObject implements TraceSnapshot
  • Field Details

  • Constructor Details

  • Method Details

    • fresh

      protected void fresh(boolean created) throws IOException
      Description copied from class: DBAnnotatedObject
      Extension point: Called when the object's fields are populated.

      This provides an opportunity for the object to initialize any non-database-backed fields that depend on the database-backed fields. Note that its use may indicate a situation better solved by a custom DBCachedObjectStoreFactory.DBFieldCodec. If both the database-backed and non-database-backed fields are used frequently, then a codec may not be indicated. If the database-backed fields are only used in this method or to encode another frequently-used field, then a codec is likely better.

      For a new object, the database-backed fields remain at their initial values. They will be saved after this method returns, so they may be further initialized with custom logic.

      For an object loaded from the database, the database-backed fields are already populated from the record when this method is called. They are not automatically saved after this method returns. This method should not further initialize database-backed fields in this case.

      Overrides:
      fresh in class DBAnnotatedObject
      Parameters:
      created - true when object is being created, or false when it is being loaded.
      Throws:
      IOException - if further initialization fails.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • set

      protected void set(long realTime, String description)
    • getTrace

      public Trace getTrace()
      Specified by:
      getTrace in interface TraceSnapshot
    • getRealTime

      public long getRealTime()
      Description copied from interface: TraceSnapshot
      Get the real creation time of this snapshot in milliseconds since the epoch
      Specified by:
      getRealTime in interface TraceSnapshot
      Returns:
      the real time
    • setRealTime

      public void setRealTime(long millis)
      Description copied from interface: TraceSnapshot
      Set the real creation time of this snapshot in milliseconds since Jan 1, 1970 12:00 AM (UTC)
      Specified by:
      setRealTime in interface TraceSnapshot
      Parameters:
      millis - the real time
    • getDescription

      public String getDescription()
      Description copied from interface: TraceSnapshot
      Get the description of the snapshot
      Specified by:
      getDescription in interface TraceSnapshot
      Returns:
    • setDescription

      public void setDescription(String description)
      Description copied from interface: TraceSnapshot
      Set the human-consumable description of the snapshot
      Specified by:
      setDescription in interface TraceSnapshot
      Parameters:
      description - the description
    • getEventThread

      public TraceThread getEventThread()
      Description copied from interface: TraceSnapshot
      If this snapshot was created because of an event, get the thread that caused it
      Specified by:
      getEventThread in interface TraceSnapshot
      Returns:
      the event thread, if applicable
    • setEventThread

      public void setEventThread(TraceThread thread)
      Description copied from interface: TraceSnapshot
      If this snapshot was create because of an event, set the thread that caused it
      Specified by:
      setEventThread in interface TraceSnapshot
      Parameters:
      thread - the event thread, if applicable
    • getSchedule

      public TraceSchedule getSchedule()
      Description copied from interface: TraceSnapshot
      Get the schedule, if applicable and known, relating this snapshot to a previous one

      This information is not always known, or even applicable. If recording a single step, ideally, this is simply the previous snap plus one step of the event thread, e.g., for snap 6, the schedule would be "5:1". For an emulated machine cached in scratch space, this should be the schedule that would recover the same machine state.

      The object managers in the trace pay no heed to this schedule. In particular, when retrieving the "most-recent" information from a snapshot with a known schedule, the "previous snap" part of that schedule is not taken into account. In other words, the managers still interpret time linearly, even though this schedule field might imply built-in forking.

      Specified by:
      getSchedule in interface TraceSnapshot
      Returns:
      the (possibly null) schedule
    • getScheduleString

      public String getScheduleString()
      Description copied from interface: TraceSnapshot
      Get the string representation of the schedule
      Specified by:
      getScheduleString in interface TraceSnapshot
      Returns:
      the (possibly empty) string representation of the schedule
    • setSchedule

      public void setSchedule(TraceSchedule schedule)
      Description copied from interface: TraceSnapshot
      Set the schedule from some previous snapshot to this one
      Specified by:
      setSchedule in interface TraceSnapshot
      Parameters:
      schedule - the schedule
    • getVersion

      public long getVersion()
      Description copied from interface: TraceSnapshot
      Get the snapshot's version, esp., when it represents a cache entry
      Specified by:
      getVersion in interface TraceSnapshot
      Returns:
      the version
      See Also:
    • setVersion

      public void setVersion(long version)
      Description copied from interface: TraceSnapshot
      Set the snapshot's version, esp., when it represents a cache entry
      Specified by:
      setVersion in interface TraceSnapshot
      Parameters:
      version - the version
      See Also:
    • delete

      public void delete()
      Description copied from interface: TraceSnapshot
      Delete this snapshot This does not delete any entries in other managers associated with this snapshot. This simply deletes the marker and accompanying metadata. However, entries associated with deleted or otherwise non-existent snapshot keys may cause interesting behavior, especially for keys which exceed the latest snapshot key.
      Specified by:
      delete in interface TraceSnapshot