Package org.refcodes.runtime
Enum Correlation
- java.lang.Object
-
- java.lang.Enum<Correlation>
-
- org.refcodes.runtime.Correlation
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Correlation>
,org.refcodes.mixin.IdAccessor<java.lang.String>
,org.refcodes.mixin.IdAccessor.IdMutator<java.lang.String>
,org.refcodes.mixin.IdAccessor.IdProperty<java.lang.String>
public enum Correlation extends java.lang.Enum<Correlation> implements org.refcodes.mixin.IdAccessor.IdProperty<java.lang.String>
TheCorrelation
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getId()
Retrieves the Correlation-ID assigned to the currentThread
.static boolean
hasAnyCorrelationId()
Evaluates whether any of the given Correlation-IDs is present (not null).java.lang.String
nextId()
Creates a new Correlation-ID no matter whether there is a Correlation-ID already assigned to the current thread or not.java.lang.String
pullId()
Returns a Correlation-ID in any case: Creates a new Correlation-ID in case there is none yet for the current thread.void
setId(java.lang.String aCorrelationId)
Assigns the given Correlation-ID to the currentThread
.static java.lang.String
toFullCorrelationId()
Returns aString
with all Correlation-IDs found separated by aDelimiter.CORRELATION_ID
character from each other.static Correlation
valueOf(java.lang.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.
-
-
-
Enum Constant Detail
-
REQUEST
public static final Correlation REQUEST
A single request spanning over multiple systems.
-
SESSION
public static final Correlation SESSION
Identifying a session for multiple requests spanning over multiple systems. traced.
-
-
Method Detail
-
values
public static Correlation[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Correlation c : Correlation.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Correlation valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
setId
public void setId(java.lang.String aCorrelationId)
Assigns the given Correlation-ID to the currentThread
.- Specified by:
setId
in interfaceorg.refcodes.mixin.IdAccessor.IdMutator<java.lang.String>
- Parameters:
aCorrelationId
- The Correlation-ID to be assigned to the currentThread
.
-
getId
public java.lang.String getId()
Retrieves the Correlation-ID assigned to the currentThread
. CallpullId()
to make sure a Correlation-ID is created for the current thread if none exists yet or callnextId()
in order to create a new Correlation-ID.- Specified by:
getId
in interfaceorg.refcodes.mixin.IdAccessor<java.lang.String>
- Returns:
- The Correlation-ID of the current
Thread
.
-
pullId
public java.lang.String pullId()
Returns a Correlation-ID in any case: Creates a new Correlation-ID in case there is none yet for the current thread. Else the current Correlation-ID is returned.- Returns:
- The Correlation-ID as of now.
-
nextId
public java.lang.String nextId()
Creates a new Correlation-ID no matter whether there is a Correlation-ID already assigned to the current thread or not.- Returns:
- the string
-
toFullCorrelationId
public static java.lang.String toFullCorrelationId()
Returns aString
with all Correlation-IDs found separated by aDelimiter.CORRELATION_ID
character from each other. Any portion of the full Correlation-ID not being set is represented by a "<?>" sequence defined byLiteral.UNKNOWN
.- Returns:
- The full Correlation-ID.
-
hasAnyCorrelationId
public static boolean hasAnyCorrelationId()
Evaluates whether any of the given Correlation-IDs is present (not null).- Returns:
- True if at least one Correlation-ID is not null.
-
-