T
- the wrapped tracerpublic abstract class QueueTracer<T extends AbstractTracer> extends AbstractTracer
AbstractTracer
but does so by wrapping and delegating to another AbstractTracer
. In particular the
current tracing context will be automatically cleared when calling wayout()
and the method stack remains empty afterwards. Thus the tracer
can be reused for another thread's tracing context without any danger to create a memory leak.
AbstractTracer.Exception
Modifier and Type | Field and Description |
---|---|
protected T |
tracer
Some tracer.
|
VERSION
Constructor and Description |
---|
QueueTracer(String name,
T tracer)
Constructor expects the tracer name and the to be wrapped tracer instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCurrentTracingContext()
Delegates to the corresponding method of the wrapped tracer.
|
void |
close()
Closes the wrapped tracer.
|
TraceMethod |
entry(String returnType,
Class clazz,
String methodSignature)
Delegates to the corresponding method of the wrapped tracer.
|
TraceMethod |
entry(String returnType,
Object object,
String methodSignature)
Delegates to the corresponding method of the wrapped tracer.
|
int |
getBufferSize()
Delegates to the corresponding method of the wrapped tracer.
|
Object |
getSyncObject()
Delegates to the corresponding method of the wrapped tracer.
|
protected AbstractThreadMap |
getThreadMap()
Delegates to the corresponding method of the wrapped tracer.
|
void |
initCurrentTracingContext()
Delegates to the corresponding method of the wrapped tracer by using the config parameter global
to all queued tracer.
|
void |
initCurrentTracingContext(int debugLevel,
boolean online)
Delegates to the corresponding method of the wrapped tracer.
|
boolean |
isAutoflush()
Delegates to the corresponding method of the wrapped tracer.
|
boolean |
isOpened()
Delegates to the corresponding method of the wrapped tracer.
|
void |
logException(LogLevel logLevel,
Throwable throwable,
Class clazz,
String methodName)
Delegates to the corresponding method of the wrapped tracer.
|
void |
logMessage(LogLevel logLevel,
String message,
Class clazz,
String methodName)
Delegates to the corresponding method of the wrapped tracer.
|
void |
open()
Opens the wrapped tracer.
|
IndentablePrintStream |
out()
Delegates to the corresponding method of the wrapped tracer.
|
protected IndentablePrintStream |
out(int level)
Delegates to the corresponding method of the wrapped tracer.
|
protected void |
readConfiguration(XPath xpath,
Node node)
Reads the configuration for this particular tracer instance by evaluating the given node with the given xpath engine.
|
protected void |
setAutoflush(boolean autoflush)
Sets the autoflush mode of the wrapped tracer
|
void |
setBufferSize(int bufferSize)
Sets the buffer size of the wrapped tracer.
|
TraceMethod |
wayout()
Delegates to the corresponding method of the wrapped tracer.
|
entry, formatStreamErrorState, formatVersionInfo, getBufferedOutputStream, getName, getNullPrintStream, getTracePrintStream, setBufferedOutputStream, setOpened, setTracePrintStream, substitute
protected final T extends AbstractTracer tracer
public Object getSyncObject()
getSyncObject
in class AbstractTracer
public int getBufferSize()
getBufferSize
in class AbstractTracer
public boolean isAutoflush()
isAutoflush
in class AbstractTracer
public boolean isOpened()
isOpened
in class AbstractTracer
public void setBufferSize(int bufferSize)
setBufferSize
in class AbstractTracer
bufferSize
- the bufferSize to setprotected void setAutoflush(boolean autoflush)
setAutoflush
in class AbstractTracer
autoflush
- the autoflush to setprotected void readConfiguration(XPath xpath, Node node) throws XPathExpressionException, AbstractTracer.Exception
AbstractTracer
readConfiguration
in class AbstractTracer
xpath
- the xpath enginenode
- the config nodeXPathExpressionException
- indicates xpath problemsAbstractTracer.Exception
- indicates problems when configuring certain tracer instancespublic void open()
open
in class AbstractTracer
public void close()
close
in class AbstractTracer
public void initCurrentTracingContext()
initCurrentTracingContext
in class AbstractTracer
public void initCurrentTracingContext(int debugLevel, boolean online)
initCurrentTracingContext
in class AbstractTracer
debugLevel
- controls the extent of the outputonline
- a value of false delivers no output of the current thread at all whereas a value of true delivers output controlled by debugLevelpublic TraceMethod entry(String returnType, Class clazz, String methodSignature)
entry
in class AbstractTracer
returnType
- the return type of the method as string representationclazz
- the class to which that method belongmethodSignature
- the remaining method signature (without return type) inclusive parameter as string representationpublic TraceMethod entry(String returnType, Object object, String methodSignature)
entry
in class AbstractTracer
returnType
- the return type of the method as string representationobject
- the object that owns the methodmethodSignature
- the remaining method signature (without return type) inclusive parameter as string representationpublic void logMessage(LogLevel logLevel, String message, Class clazz, String methodName)
logMessage
in class AbstractTracer
logLevel
- one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVEREmessage
- the to be logged messageclazz
- the originating classmethodName
- the originating methodpublic void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName)
logException
in class AbstractTracer
logLevel
- one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVEREthrowable
- the to be logged throwableclazz
- the originating classmethodName
- protected AbstractThreadMap getThreadMap()
getThreadMap
in class AbstractTracer
public TraceMethod wayout()
wayout
in class AbstractTracer
public IndentablePrintStream out()
out
in class AbstractTracer
IndentablePrintStream
protected IndentablePrintStream out(int level)
out
in class AbstractTracer
level
- the level of the to be printed dataIndentablePrintStream
public void clearCurrentTracingContext()
clearCurrentTracingContext
in class AbstractTracer
Copyright © 2014 Christof Reichardt. All rights reserved. (Build: 26-May-2014)