Class NullLoggingContextFacilityImpl
- java.lang.Object
-
- com.opencloud.rhino.facilities.logging.NullLoggingContextFacilityImpl
-
- All Implemented Interfaces:
LoggingContextFacility
public class NullLoggingContextFacilityImpl extends Object implements LoggingContextFacility
-
-
Field Summary
Fields Modifier and Type Field Description static NullLoggingContextFacilityImplINSTANCE-
Fields inherited from interface com.opencloud.rhino.facilities.logging.LoggingContextFacility
CONFIG_PROPERTY_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearThreadContext()Clears the current thread’s logging context.Map<String,String>getImmutableActivityContext(ActivityHandle activityHandle)Gets an immutable copy of the activity’s logging context.Map<String,String>getImmutableThreadContext()Gets an immutable copy of the current thread’s logging context.voidput(String key, String value)Add a single key/value pair to the current thread’s logging context.voidput(ActivityHandle activityHandle, String key, String value)Add a key value pair to this activity’s logging context.voidputAll(Map<String,String> entries)Add a map of key/value pairs to the current thread’s logging context.voidputAll(ActivityHandle activityHandle, Map<String,String> entries)Put all context entries into the current logging context.voidremove(String key)Remove a key from the current thread’s logging context.voidremove(ActivityHandle activityHandle, String key)Remove an entry from the logging context.
-
-
-
Field Detail
-
INSTANCE
public static NullLoggingContextFacilityImpl INSTANCE
-
-
Method Detail
-
getImmutableActivityContext
public Map<String,String> getImmutableActivityContext(ActivityHandle activityHandle) throws UnrecognizedActivityHandleException
Description copied from interface:LoggingContextFacilityGets an immutable copy of the activity’s logging context.
Intended for use when calling up from the network, to fetch the existing state of an activity, once the activity is known.
- Specified by:
getImmutableActivityContextin interfaceLoggingContextFacility- Parameters:
activityHandle- Activity handle for the activity to get the Logging context for.- Returns:
- Map<String, String> context
- Throws:
UnrecognizedActivityHandleException
-
getImmutableThreadContext
public Map<String,String> getImmutableThreadContext()
Description copied from interface:LoggingContextFacilityGets an immutable copy of the current thread’s logging context.
Intended for use by components with internal thread pools, to manage moving a logging context between an RA internal thread, and an activity plus rhino thread.
- Specified by:
getImmutableThreadContextin interfaceLoggingContextFacility- Returns:
- Map<String, String> context
-
clearThreadContext
public void clearThreadContext()
Description copied from interface:LoggingContextFacilityClears the current thread’s logging context.
Provided for use by components with internal thread pools, to remove the logging context from an RA internal thread when the thread has completed work associated with an activity.
- Specified by:
clearThreadContextin interfaceLoggingContextFacility
-
put
public void put(String key, String value)
Description copied from interface:LoggingContextFacilityAdd a single key/value pair to the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Specified by:
putin interfaceLoggingContextFacility- Parameters:
key- String context key to add to the thread’s logging contextvalue- String context value to add to the thread’s logging context
-
putAll
public void putAll(Map<String,String> entries)
Description copied from interface:LoggingContextFacilityAdd a map of key/value pairs to the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Specified by:
putAllin interfaceLoggingContextFacility- Parameters:
entries- Map of key, value pairs to add to the thread’s logging context
-
remove
public void remove(String key)
Description copied from interface:LoggingContextFacilityRemove a key from the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Specified by:
removein interfaceLoggingContextFacility- Parameters:
key- String key to remove from the thread’s logging context
-
put
public void put(ActivityHandle activityHandle, String key, String value) throws UnrecognizedActivityHandleException
Description copied from interface:LoggingContextFacilityAdd a key value pair to this activity’s logging context. It will be logged in all subsequent log statements for this activity.
Care must be taken to not overload the context with too many entries.
- Specified by:
putin interfaceLoggingContextFacilitykey- String key to add.value- String value to add.- Throws:
UnrecognizedActivityHandleException- if the handle is null, or does not point to a live activity
-
putAll
public void putAll(ActivityHandle activityHandle, Map<String,String> entries) throws UnrecognizedActivityHandleException
Description copied from interface:LoggingContextFacilityPut all context entries into the current logging context. It will be logged in all subsequent log statements for this activity.
Care must be taken to not overload the context with too many entries.
- Specified by:
putAllin interfaceLoggingContextFacilityentries- String key and value pairs to add- Throws:
UnrecognizedActivityHandleException- if the handle is null, or does not point to a live activity
-
remove
public void remove(ActivityHandle activityHandle, String key) throws UnrecognizedActivityHandleException
Description copied from interface:LoggingContextFacilityRemove an entry from the logging context. This entry will not be logged after this call.
- Specified by:
removein interfaceLoggingContextFacilitykey- String key to remove.- Throws:
UnrecognizedActivityHandleException- if the handle is null, or does not point to a live activity
-
-