Skip to content

Commit 551652a

Browse files
committed
Synchronize JeroMqAppender test methods
The `sendRcFalse` and `sendRcTrue` fields of `JeroMqAppender` are accessed without the necessary synchronization, which causes some test failures.
1 parent 8ee4237 commit 551652a

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqAppender.java

+15-7
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,30 @@ public boolean stop(final long timeout, final TimeUnit timeUnit) {
224224
return stopped;
225225
}
226226

227-
// not public, handy for testing
228-
int getSendRcFalse() {
227+
/**
228+
* Used in tests
229+
*/
230+
synchronized int getSendRcFalse() {
229231
return sendRcFalse;
230232
}
231233

232-
// not public, handy for testing
233-
int getSendRcTrue() {
234+
/**
235+
* Used in tests
236+
*/
237+
synchronized int getSendRcTrue() {
234238
return sendRcTrue;
235239
}
236240

237-
// not public, handy for testing
238-
void resetSendRcs() {
241+
/**
242+
* Used in tests
243+
*/
244+
synchronized void resetSendRcs() {
239245
sendRcTrue = sendRcFalse = 0;
240246
}
241247

242-
// not public, handy for testing
248+
/**
249+
* Used in tests
250+
*/
243251
JeroMqManager getManager() {
244252
return manager;
245253
}

0 commit comments

Comments
 (0)