Commit 695cf06
committed
[AsyncFileHandler] use 'volatile' for fRecordBuffer
This field is accessed by various threads, whenever logging is
happening. Once in a while the buffer is pushed to the writer
queue, and a new empty buffer is created. Without the volatile
keyword on this field, it could be that some logger threads will
still see the old buffer after it has been queued, instead of
seeing the newly created one.
Also, for explicitness sake, mark field fFileHandler as final.
It's already used as such, and is only set in the constructor,
but this makes it explicit.
Note: I do not think it's necessary to have other handler-related
fields marked as "volatile" (fEncoding, fFilter, fErrorManager,
...), since these are only read during initialization. They can
be set later, but the real effect of setting them is that the new
value is propagated to the private FileHandler, where it's used.
Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>1 parent 85839ff commit 695cf06
File tree
1 file changed
+2
-2
lines changed- src/main/java/org/eclipse/tracecompass/traceeventlogger
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
0 commit comments