com.sleepycat.je.log
Class Trace

java.lang.Object
  extended by com.sleepycat.je.log.Trace
All Implemented Interfaces:
Loggable

public class Trace
extends Object
implements Loggable

Trace logs event tracing messages into .jdb files. Only critical messages that should always be included in a log should use this functionality.


Constructor Summary
Trace()
          Create a trace record that will be filled in from the log.
Trace(String msg)
          Create a new debug record.
 
Method Summary
 void dumpLog(StringBuilder sb, boolean verbose)
          Write the object into the string buffer for log dumping.
 boolean equals(Object obj)
          Override Object.equals
 int getLogSize()
           
 String getMessage()
           
 long getTransactionId()
           
 int hashCode()
          Just in case it's ever used as a hash key.
 boolean logicalEquals(Loggable other)
           
 void readFromLog(ByteBuffer itemBuffer, int entryVersion)
          Initialize this object from the data in itemBuf.
 String toString()
           
static void trace(EnvironmentImpl envImpl, String message)
          Convenience method to create a log entry containing this trace msg.
static long trace(EnvironmentImpl envImpl, Trace traceMsg)
          Trace a trace object, unit tests only.
static void traceLazily(EnvironmentImpl envImpl, String message)
          Convenience method to create a log entry (lazily) containing this trace msg.
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trace

public Trace(String msg)
Create a new debug record.


Trace

public Trace()
Create a trace record that will be filled in from the log.

Method Detail

getMessage

public String getMessage()
Returns:
message part of trace record.

trace

public static void trace(EnvironmentImpl envImpl,
                         String message)
Convenience method to create a log entry containing this trace msg.


trace

public static long trace(EnvironmentImpl envImpl,
                         Trace traceMsg)
Trace a trace object, unit tests only.


traceLazily

public static void traceLazily(EnvironmentImpl envImpl,
                               String message)
Convenience method to create a log entry (lazily) containing this trace msg. Lazy tracing is used when tracing is desired, but the .jdb files are not initialized.


getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer logBuffer)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Parameters:
logBuffer - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        int entryVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, int)

dumpLog

public void dumpLog(StringBuilder sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuilder, boolean)

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()

logicalEquals

public boolean logicalEquals(Loggable other)
Specified by:
logicalEquals in interface Loggable
Returns:
true if these two loggable items are logically the same. Used for replication testing.
See Also:
Loggable.logicalEquals(com.sleepycat.je.log.Loggable)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

hashCode

public int hashCode()
Just in case it's ever used as a hash key.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Override Object.equals

Overrides:
equals in class Object


Copyright (c) 2004-2012 Oracle. All rights reserved.