public enum Correlation extends Enum<Correlation> implements org.refcodes.mixin.IdAccessor.IdProperty<String>
Correlation
assigns an according (as of the enumeration)
correlation ID to the invoking process, this ID is used in log files and is
part of the process's request or response pay-load in order to track process
execution throughout a JVM.Enum Constant and Description |
---|
CORRELATION
A single request spanning over multiple systems.
|
SESSION
Identifying a transaction, e.g. multiple operations separately being
traced.
|
Modifier and Type | Method and Description |
---|---|
String |
getId()
Retrieves the correlation ID assigned to the current
Thread . |
static boolean |
hasAnyCorrelationId()
Evaluates whether any of the given correlation IDs is present (not null).
|
void |
initialize()
Creates a new correlation ID in case there is none yet for the current
thread.
|
void |
reset()
Creates a new correlation ID no matter whether there is a correlation ID
already assigned to the current thread or not.
|
void |
setId(String aCorrelationId)
Assigns the given correlation ID to the current
Thread . |
static String |
toFullCorrelationId()
Returns a
String with all correlation IDs found separated by a
Delimiter.CORRELATION_ID_DELIMITER character from each other. |
static Correlation |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Correlation[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Correlation CORRELATION
public static final Correlation SESSION
public static Correlation[] values()
for (Correlation c : Correlation.values()) System.out.println(c);
public static Correlation valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void setId(String aCorrelationId)
Thread
.public String getId()
Thread
.
Call initialize()
to make sure a correlation ID is created for
the current thread if none exists yet or call reset()
in order
to create a new correlation ID.public void initialize()
public void reset()
public static String toFullCorrelationId()
String
with all correlation IDs found separated by a
Delimiter.CORRELATION_ID_DELIMITER
character from each other. Any
portion of the full correlation ID not being set is represented by a
">" sequence defined by Literal.UNKNOWN
.public static boolean hasAnyCorrelationId()
Copyright © 2017. All rights reserved.