use of org.apache.logging.log4j.util.StringMap in project logging-log4j2 by apache.
the class AsyncLogger method translateTo.
/*
* (non-Javadoc)
*
* @see com.lmax.disruptor.EventTranslatorVararg#translateTo(java.lang.Object, long, java.lang.Object[])
*/
@Override
public void translateTo(final RingBufferLogEvent event, final long sequence, final Object... args) {
// Implementation note: candidate for optimization: exceeds 35 bytecodes.
final AsyncLogger asyncLogger = (AsyncLogger) args[0];
final StackTraceElement location = (StackTraceElement) args[1];
final String fqcn = (String) args[2];
final Level level = (Level) args[3];
final Marker marker = (Marker) args[4];
final Message message = (Message) args[5];
final Throwable thrown = (Throwable) args[6];
// needs shallow copy to be fast (LOG4J2-154)
final ContextStack contextStack = ThreadContext.getImmutableStack();
final Thread currentThread = Thread.currentThread();
final String threadName = THREAD_NAME_CACHING_STRATEGY.getThreadName();
event.setValues(asyncLogger, asyncLogger.getName(), marker, fqcn, level, message, thrown, // in the AsyncLogger#actualAsyncLog method
CONTEXT_DATA_INJECTOR.injectContextData(null, (StringMap) event.getContextData()), contextStack, currentThread.getId(), threadName, currentThread.getPriority(), location, CLOCK.currentTimeMillis(), nanoClock.nanoTime());
}
use of org.apache.logging.log4j.util.StringMap in project logging-log4j2 by apache.
the class CopyOnWriteSortedArrayThreadContextMap method putValue.
@Override
public void putValue(final String key, final Object value) {
StringMap map = localMap.get();
map = map == null ? createStringMap() : createStringMap(map);
map.putValue(key, value);
map.freeze();
localMap.set(map);
}
use of org.apache.logging.log4j.util.StringMap in project logging-log4j2 by apache.
the class CopyOnWriteSortedArrayThreadContextMap method removeAll.
@Override
public void removeAll(final Iterable<String> keys) {
final StringMap map = localMap.get();
if (map != null) {
final StringMap copy = createStringMap(map);
for (final String key : keys) {
copy.remove(key);
}
copy.freeze();
localMap.set(copy);
}
}
use of org.apache.logging.log4j.util.StringMap in project logging-log4j2 by apache.
the class CopyOnWriteSortedArrayThreadContextMap method remove.
@Override
public void remove(final String key) {
final StringMap map = localMap.get();
if (map != null) {
final StringMap copy = createStringMap(map);
copy.remove(key);
copy.freeze();
localMap.set(copy);
}
}
use of org.apache.logging.log4j.util.StringMap in project logging-log4j2 by apache.
the class CopyOnWriteSortedArrayThreadContextMap method hashCode.
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
final StringMap map = this.localMap.get();
result = prime * result + ((map == null) ? 0 : map.hashCode());
return result;
}
Aggregations