Class Messages
java.lang.Object
com.northconcepts.datapipeline.core.Messages
Thread-local container for messages and exceptions originating in asynchronous operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a debug message, optionally capturing the caller's current stack trace.voidAdds a debug message that carries the given exception.voidaddMessage(Message message) voidaddWarning(String message, boolean recordStackTrace) Adds a warning, optionally capturing the caller's current stack trace.voidaddWarning(String message, Throwable exception) Adds a warning that carries the given exception.static final voidRemoves the thread-local instance if one exists.static final MessagesReturns the current thread's container, creating it if needed (a discarding container while collection is disabled).static final MessagesgetCurrent(boolean create) Returns the current thread's container, creating it only ifcreateis true (otherwise null when there is none); returns a discarding container while collection is disabled.getMessage(int index) intstatic booleanIndicates if messages are collected, for all threads; when false,getCurrent()returns a container that discards them (defaults to true).static final voidpop()Restores the current thread's container saved by the matchingpush().static final voidpush()Saves the current thread's container on a stack and starts a new, empty one; restore it withpop().static final voidsetCurrent(Messages messages) Replaces the current thread's container (ignored while collection is disabled); not intended for application use.static voidsetEnabled(boolean enabled) Indicates if messages are collected, for all threads; when false,getCurrent()returns a container that discards them (defaults to true).toString()
-
Constructor Details
-
Messages
public Messages()
-
-
Method Details
-
isEnabled
public static boolean isEnabled()Indicates if messages are collected, for all threads; when false,getCurrent()returns a container that discards them (defaults to true). -
setEnabled
public static void setEnabled(boolean enabled) Indicates if messages are collected, for all threads; when false,getCurrent()returns a container that discards them (defaults to true). -
getCurrent
Returns the current thread's container, creating it only ifcreateis true (otherwise null when there is none); returns a discarding container while collection is disabled. -
getCurrent
Returns the current thread's container, creating it if needed (a discarding container while collection is disabled). -
setCurrent
Replaces the current thread's container (ignored while collection is disabled); not intended for application use. -
clearCurrent
public static final void clearCurrent()Removes the thread-local instance if one exists. -
push
public static final void push()Saves the current thread's container on a stack and starts a new, empty one; restore it withpop(). -
pop
public static final void pop()Restores the current thread's container saved by the matchingpush(). -
addMessage
-
getMessageCount
public int getMessageCount() -
getMessage
-
addWarning
Adds a warning, optionally capturing the caller's current stack trace. -
addDebug
Adds a debug message, optionally capturing the caller's current stack trace. -
addWarning
Adds a warning that carries the given exception. -
addDebug
Adds a debug message that carries the given exception. -
toString
-