Skip to content

CELDEV-1314 - Outgoing/IncomingObservationManager#289

Open
msladek wants to merge 2 commits intodevfrom
CELDEV-1314
Open

CELDEV-1314 - Outgoing/IncomingObservationManager#289
msladek wants to merge 2 commits intodevfrom
CELDEV-1314

Conversation

@msladek
Copy link
Copy Markdown
Member

@msladek msladek commented May 8, 2026

@msladek msladek requested a review from fpichler May 8, 2026 15:04
@fpichler fpichler changed the title Outgoing/IncomingObservationManager CELDEV-1314 - Outgoing/IncomingObservationManager May 10, 2026
Copy link
Copy Markdown
Member

@fpichler fpichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the LGPL header from IncomingObservationManager.java (and its omission from the newly created OutgoingObservationManager.java) is problematic.

Could we please restore the LGPL headers to the modified files and add them to the newly created files? According to the Free Software Foundation's instructions on applying GNU licenses, a root LICENSE file isn't sufficient on its own. They state: 'You also need to put a license notice in each file of the program... because anyone could copy an individual file out of the package.'

@msladek msladek requested a review from fpichler May 10, 2026 22:37
Comment on lines +130 to +131
checkState(networkAdapter != null,
"remote observation is enabled but network adapter implementation missing");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In edge cases, when the NetworkAdapter bean disappears at runtime (e.g., during Spring shutdown), the checkState will throw an unchecked IllegalStateException inside processQueue(), that exception is not caught. It bubbles up and out of the finally block, and out of ObservationManager.notify().

Why this matters: The code that triggered the local event (for example, a user saving a document, an HTTP request handler, or a background job) will suddenly receive an unexpected IllegalStateException bubbling up from the observation layer.

  • If this happens during an HTTP request, the user gets a 500 Internal Server Error.
  • If it happens during a database transaction, it might cause a transaction rollback.

Suggestion: Consider moving the checkState inside the try-catch block (or handle it in processQueue()), the system will simply log the ERROR ("network adapter missing") and gracefully return. The local thread that initiated the event will continue completely undisturbed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping "Remote" from the name makes IncomingObservationManager and OutgoingObservationManager sound like generic local event routers.

Rename to IncomingRemoteObservationManager (or RemoteEventReceiver). This immediately signals that it handles network-bound events, avoiding confusion with the core ObservationManager.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping "Remote" from the name makes IncomingObservationManager and OutgoingObservationManager sound like generic local event routers.

Rename to OutgoingRemoteObservationManager (or RemoteEventDispatcher). This immediately signals that it handles network-bound events, avoiding confusion with the core ObservationManager.

return configuration.isEnabled() && !remoteEventManagerContext.isRemoteState();
}

public void notifyLocalThenRemote(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notifyLocalThenRemote(LocalEventData, Consumer): While it explains exactly what happens, it reads more like a comment than a method name.
Alternative: notifyWithRemotePropagation(...) or executeWithRemoteFlush(...).

}
}

private boolean queue(LocalEventData localEvent) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queue(LocalEventData): This method name is a bit ambiguous (noun or verb?) and it returns a boolean representing whether this is the first event in the queue.
Alternative: enqueueAndCheckIfFirst(...) or initQueueAndAdd(...) which makes the boolean return value obvious.

private final EventConverterManager eventConverterManager;
private final RemoteObservationManagerContext remoteEventManagerContext;
private final BeanFactory beanFactory;
private final ThreadLocal<LinkedList<LocalEventData>> eventQueue = new ThreadLocal<>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventQueue (ThreadLocal<LinkedList<LocalEventData>>): Naming a ThreadLocal just eventQueue hides its thread-bound nature when reading the code further down.
Alternative: pendingRemoteEvents or threadLocalEventQueue.

@fpichler fpichler assigned msladek and unassigned fpichler May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants