Nikolay Izhikov created IGNITE-28934:
----------------------------------------

             Summary: Create Message using direct call
                 Key: IGNITE-28934
                 URL: https://issues.apache.org/jira/browse/IGNITE-28934
             Project: Ignite
          Issue Type: Task
            Reporter: Nikolay Izhikov


Currently, Messages instances created using reflection
{code:java}
    protected <T extends Message> void register(IgniteMessageFactory factory, 
Class<T> cls, short id) {
        Constructor<T> ctor;

        try {
            ctor = cls.getConstructor();
        }
        catch (NoSuchMethodException e) {
            throw new IgniteException("Failed to register message of type " + 
cls.getSimpleName(), e);
        }

        register(factory, cls, id, () -> {
            try {
                return ctor.newInstance();
            }
            catch (Exception e) {
                throw new IgniteException("Failed to create message of type " + 
cls.getSimpleName(), e);
            }
        });
    }

{code}

We can generate direct constructor call.
This will improve performance a bit and made code cleaner.



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

Reply via email to