mynameborat commented on code in PR #1652:
URL: https://github.com/apache/samza/pull/1652#discussion_r1092298435
##########
samza-log4j2/src/main/java/org/apache/samza/logging/log4j2/StreamAppender.java:
##########
@@ -186,13 +190,20 @@ public void append(LogEvent event) {
if (!systemInitialized) {
// configs are needed to set up producer system, so check that before
actually initializing
if (this.loggingContextHolder.getConfig() != null) {
- synchronized (this) {
- if (!systemInitialized) {
- setupSystem();
- systemInitialized = true;
+ if (setUpSystemLock.tryLock(SET_UP_SYSTEM_TIMEOUT_MILLI_SECONDS,
TimeUnit.MILLISECONDS)) {
+ try {
+ if (!systemInitialized) {
+ setupSystem();
Review Comment:
There are no guarantees from `setupSystem` on providing idempotence nor able
to setup system on the subsequent retries in case of failures.
So if we are handling externally for the former, why not handle the latter
as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]