File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
log4j-core/src/main/java/org/apache/logging/log4j/core/pattern Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -328,16 +328,15 @@ private Formatter getThreadLocalFormatter() {
328
328
}
329
329
330
330
private void formatWithoutThreadLocals (final Instant instant , final StringBuilder output ) {
331
- CachedTime cached = cachedTime .get ();
331
+ final CachedTime effective ;
332
+ final CachedTime cached = cachedTime .get ();
332
333
if (instant .getEpochSecond () != cached .epochSecond || instant .getNanoOfSecond () != cached .nanoOfSecond ) {
333
- final CachedTime newTime = new CachedTime (instant );
334
- if (cachedTime .compareAndSet (cached , newTime )) {
335
- cached = newTime ;
336
- } else {
337
- cached = cachedTime .get ();
338
- }
334
+ effective = new CachedTime (instant );
335
+ cachedTime .compareAndSet (cached , effective );
336
+ } else {
337
+ effective = cached ;
339
338
}
340
- output .append (cached .formatted );
339
+ output .append (effective .formatted );
341
340
}
342
341
343
342
/**
You can’t perform that action at this time.
0 commit comments