[
https://issues.apache.org/jira/browse/IGNITE-16295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kirill Tkalenko updated IGNITE-16295:
-------------------------------------
Description:
At the moment, listeners *any()* for a polymorphic configuration do not get
specific instances, but general ones.
The following example will clearly show the problem:
{code:java}
@Config
public class TableConfigurationSchema {
@NamedConfigValue
public BaseIndexConfigurationSchema indexes;
}
@PolymorphicConfig
public class BaseIndexConfigurationSchema {
@PolymorphicId
public String type;
}
@PolymorphicConfigInstance("hash")
public class HashIndexConfigurationSchema extends BaseIndexConfigurationSchema {
@Value
public String column;
}
@PolymorphicConfigInstance("sorted")
public class SortedIndexConfigurationSchema extends
BaseIndexConfigurationSchema {
@Value
public String column;
}
...
rootConfig.tables().any().listen(ctx->{
// It's falling here.
assert ctx.newValue() instanceof HashIndexView;
return CompletableFuture.completedFuture(null);
});
rootConfig.tables()
.change(c->c.create("0",c1->c1.convert(HashIndexChange.class).changeColumn("idx")))
.get(1,SECONDS);
{code}
was:
At the moment, listeners *any()* for a polymorphic configuration do not get
specific instances, but general ones.
The following example will clearly show the problem:
{code:java}
@Config
public class TableConfigurationSchema {
@NamedConfigValue
public BaseIndexConfigurationSchema indexes;
}
@PolymorphicConfig
public class BaseIndexConfigurationSchema {
@PolymorphicId
public String type;
}
@PolymorphicConfigInstance("hash")
public class HashIndexConfigurationSchema extends BaseIndexConfigurationSchema {
@Value
public String column;
}
@PolymorphicConfigInstance("sorted")
public class SortedIndexConfigurationSchema extends
BaseIndexConfigurationSchema {
@Value
public String column;
}
...
rootConfig.tables().any().listen(ctx->{
// It's falling here.
assert ctx.newValue()instanceof HashIndexView;
return CompletableFuture.completedFuture(null);
});
rootConfig.tables()
.change(c->c.create("0",c1->c1.convert(HashIndexChange.class).changeColumn("idx")))
.get(1,SECONDS);
{code}
> Listeners "any()" do not get specific instances of the polymorphic
> configuration, but the general one
> -----------------------------------------------------------------------------------------------------
>
> Key: IGNITE-16295
> URL: https://issues.apache.org/jira/browse/IGNITE-16295
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 3.0.0-alpha3
> Reporter: Kirill Tkalenko
> Assignee: Kirill Tkalenko
> Priority: Major
> Labels: ignite-3
> Fix For: 3.0.0-alpha4
>
>
> At the moment, listeners *any()* for a polymorphic configuration do not get
> specific instances, but general ones.
> The following example will clearly show the problem:
> {code:java}
> @Config
> public class TableConfigurationSchema {
> @NamedConfigValue
> public BaseIndexConfigurationSchema indexes;
> }
> @PolymorphicConfig
> public class BaseIndexConfigurationSchema {
> @PolymorphicId
> public String type;
> }
> @PolymorphicConfigInstance("hash")
> public class HashIndexConfigurationSchema extends
> BaseIndexConfigurationSchema {
> @Value
> public String column;
> }
> @PolymorphicConfigInstance("sorted")
> public class SortedIndexConfigurationSchema extends
> BaseIndexConfigurationSchema {
> @Value
> public String column;
> }
> ...
> rootConfig.tables().any().listen(ctx->{
> // It's falling here.
> assert ctx.newValue() instanceof HashIndexView;
> return CompletableFuture.completedFuture(null);
> });
> rootConfig.tables()
>
> .change(c->c.create("0",c1->c1.convert(HashIndexChange.class).changeColumn("idx")))
> .get(1,SECONDS);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)