class IgniteMessageFactoryImpl implements IgniteMessageFactory {

    @Override public void register(short directType, Supplier<Message> supplier) throws IgniteException {
        if (initialized) {
            throw new IllegalStateException("Message factory is already initialized. " +
                    "Registration of new message types is forbidden.");
        }

        int idx = directTypeToIndex(directType);

        Supplier<Message> curr = msgSuppliers[idx];

        if (curr == null) {
            msgSuppliers[idx] = supplier;

            minIdx = Math.min(idx, minIdx);

            maxIdx = Math.max(idx, maxIdx);

            cnt++;
        }
        else
            throw new IgniteException("Message factory is already registered for direct type: " + directType);
    }

    public  IgniteMessageFactoryImpl(MessageFactory[] factories);

}