tkalkirill commented on a change in pull request #602:
URL: https://github.com/apache/ignite-3/pull/602#discussion_r798359386
##########
File path:
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/io/PageIoRegistry.java
##########
@@ -33,58 +33,77 @@
/**
* Loads all {@link IoVersions} from a {@link PageIoModule} using the
{@link ServiceLoader} mechanism.
*
- * @throws IllegalStateException If there's an invalid page type or
several different {@link IoVersions} instances for the same type.
+ * @return {@code this} for code chaining.
+ * @throws IllegalStateException If there's an invalid page type or
several {@link IoVersions} instances for the same type.
*/
- public void loadFromServiceLoader() {
+ public PageIoRegistry loadAllFromServiceLoader() {
ServiceLoader<PageIoModule> serviceLoader =
ServiceLoader.load(PageIoModule.class);
for (PageIoModule pageIoModule : serviceLoader) {
- for (IoVersions<?> ios : pageIoModule.ioVersions()) {
- if (ios.getType() == 0) {
- throw new IllegalStateException("Type 0 is reserved and
can't be used: " + ios);
- }
+ for (IoVersions<?> ioVersions : pageIoModule.ioVersions()) {
+ load(ioVersions);
+ }
+ }
- if (ioVersions[ios.getType()] != null &&
!ioVersions[ios.getType()].equals(ios)) {
- throw new IllegalStateException("Duplicated IOVersions
found: " + ios);
- }
+ return this;
+ }
- ioVersions[ios.getType()] = ios;
- }
+ /**
+ * Loads {@link IoVersions}'s.
+ *
+ * @return {@code this} for code chaining.
+ * @throws IllegalStateException If there's an invalid page type or
several {@link IoVersions} instances for the same type.
+ */
+ public PageIoRegistry load(IoVersions<?>... versions) {
Review comment:
Replace with **org.apache.ignite.internal.pagememory.PageIoRegistryEx**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]