Class IgniteMessageFactoryImpl
- java.lang.Object
-
- org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl
-
- All Implemented Interfaces:
MessageFactory
public class IgniteMessageFactoryImpl extends Object implements MessageFactory
Message factory implementation which is responsible for instantiation of all communication messages.
-
-
Constructor Summary
Constructors Constructor Description IgniteMessageFactoryImpl(MessageFactoryProvider[] factories)Contructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Messagecreate(short directType)Creates new message instance of provided direct type.voidregister(short directType, Supplier<Message> supplier)Register message factory with given direct type.short[]registeredDirectTypes()Returns direct types of all registered messages.
-
-
-
Constructor Detail
-
IgniteMessageFactoryImpl
public IgniteMessageFactoryImpl(MessageFactoryProvider[] factories)
Contructor.- Parameters:
factories- Concrete message factories or message factory providers. Cfn't be empty ornull.
-
-
Method Detail
-
register
public void register(short directType, Supplier<Message> supplier) throws IgniteExceptionRegister message factory with given direct type. All messages must be registered during construction of class which implements this interface. Any invocation of this method after initialization is done must throwIllegalStateExceptionexception.- Specified by:
registerin interfaceMessageFactory- Parameters:
directType- Direct type.supplier- Message factory.- Throws:
IgniteException- In case of attempt to register message with direct type which is already registered.
-
create
@Nullable public @Nullable Message create(short directType)
Creates new message instance of provided direct type.- Specified by:
createin interfaceMessageFactory- Parameters:
directType- Message direct type.- Returns:
- Message instance.
- Throws:
IgniteException- If there are no any message factory for givendirectType.
-
registeredDirectTypes
public short[] registeredDirectTypes()
Returns direct types of all registered messages.- Returns:
- Direct types of all registered messages.
-
-