@Test public void testCreate() { MessageFactory[] factories = {new TestMessageFactoryPovider(), new TestMessageFactory()}; IgniteMessageFactoryImpl msgFactory = new IgniteMessageFactoryImpl(factories); Message msg; msg = msgFactory.create(TEST_MSG_1_TYPE); assertTrue(msg instanceof TestMessage1); msg = msgFactory.create(TEST_MSG_2_TYPE); assertTrue(msg instanceof TestMessage2); msg = msgFactory.create(TEST_MSG_42_TYPE); assertTrue(msg instanceof TestMessage42); short[] directTypes = msgFactory.registeredDirectTypes(); assertArrayEquals(directTypes, new short[] {TEST_MSG_1_TYPE, TEST_MSG_2_TYPE, TEST_MSG_42_TYPE}); }
@Override public @Nullable Message create(short directType) { Supplier<Message> supplier = msgSuppliers[directTypeToIndex(directType)]; if (supplier == null) throw new IgniteException("Invalid message type: " + directType); return supplier.get(); }
IgniteMessageFactoryImpl implements IgniteMessageFactory { @Override public @Nullable Message create(short directType) { Supplier<Message> supplier = msgSuppliers[directTypeToIndex(directType)]; if (supplier == null) throw new IgniteException("Invalid message type: " + directType); return supplier.get(); } }
IgniteMessageFactoryImpl implements IgniteMessageFactory { @Override public @Nullable Message create(short directType) { Supplier<Message> supplier = msgSuppliers[directTypeToIndex(directType)]; if (supplier == null) throw new IgniteException("Invalid message type: " + directType); return supplier.get(); } IgniteMessageFactoryImpl(MessageFactory[] factories); }
IgniteMessageFactoryImpl implements IgniteMessageFactory { @Override public @Nullable Message create(short directType) { Supplier<Message> supplier = msgSuppliers[directTypeToIndex(directType)]; if (supplier == null) throw new IgniteException("Invalid message type: " + directType); return supplier.get(); } IgniteMessageFactoryImpl(MessageFactory[] factories); @Override void register(short directType, Supplier<Message> supplier); @Override @Nullable Message create(short directType); short[] registeredDirectTypes(); }
IgniteMessageFactoryImpl implements IgniteMessageFactory { @Override public @Nullable Message create(short directType) { Supplier<Message> supplier = msgSuppliers[directTypeToIndex(directType)]; if (supplier == null) throw new IgniteException("Invalid message type: " + directType); return supplier.get(); } IgniteMessageFactoryImpl(MessageFactory[] factories); @Override void register(short directType, Supplier<Message> supplier); @Override @Nullable Message create(short directType); short[] registeredDirectTypes();  }