Andrey Mashenkov created IGNITE-24165:
-----------------------------------------

             Summary: EventLog interface refactoring.
                 Key: IGNITE-24165
                 URL: https://issues.apache.org/jira/browse/IGNITE-24165
             Project: Ignite
          Issue Type: Bug
          Components: general
            Reporter: Andrey Mashenkov


As for now, `EventLog.log(Supplier<Event>)` method javadoc doesn't describe the 
method purposes, contract and Supplier parameter limitations.

AFAIK, the lamda is passed for performance reasons, avoiding Event object 
instantiation when not needed. As a fact, the implementation creates an Event 
in-place unconditionally. 
So, the optimization just doesn't work.

On the other hand, the interface claims nothing if implementation can be sync 
or async.
So, should the user bother with lamda thread-safety.

Let's fix javadoc and method signature. I'd expect one of these:
1. The event is constructed outside the method and the method signature is 
straightforward.
{code:java}
void log(Event event);
{code}
2. The factory and EventType is passed to the method. Javadoc declares the 
factory may be called synchronously in the same thread, or not called at all 
(if no listeners for the EventType was registered).
{code:java}
void log(EventType type, Supplier<Event> factory);
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to