[wildfly-dev] best way to get extensions to apply model changes immediately at runtime?

Brian Stansberry brian.stansberry at redhat.com
Thu Apr 28 09:06:55 EDT 2016


On 4/28/16 7:54 AM, Jeff Mesnil wrote:
>
>> On 28 Apr 2016, at 14:53, Brian Stansberry <brian.stansberry at redhat.com> wrote:
>>
>> On 4/28/16 7:42 AM, Jeff Mesnil wrote:
>>>> To register your custom handler you need to override
>>>> PersistentResourceDefinition.registerAttributes so instead of calling
>>>> the superclass (which registers ReloadRequiredWriteAttributeHandler for
>>>> all attributes) instead you register your handler(s).
>>>>
>>>> (Tomaz, I think we need to make this write handler registration easier.
>>>> Perhaps something like a
>>>> PersistentResourceDefinition.getAttributeHandlers() method that returns
>>>> a Map<String, OperationStepHandler>. And then registerAttributes uses
>>>> the map instead of hardcoding ReloadRequiredWriteAttributeHandler.
>>>> Default impl just fills the map values with
>>>> ReloadRequiredWriteAttributeHandler.)
>>>
>>> Couldn’t we add a setWriteAttributeHandler(OSH) on the AttributeDefinition and default to ReloadRequiredWriteAttributeHandler if it’s not present?
>>>
>>
>> Not without making AD mutable, which I don't want to do, just because.
>
> I sent my mail too fast! :) I meant on the AttributeDefinitionBuilder.
>

I was thinking along those lines as I responded, but I think you get a 
kind of chicken/egg situation, since the OSH needs the AD in its 
constructor.

Hmm, but the OSH could accept builders instead of ADs and then call 
setWriteAttributeHandler(this).

This would need some trickery in the builders, e.g. avoid building the 
same AD multiple times for use in the MRR, add handler and 
write-attribute handler.


-- 
Brian Stansberry
Senior Principal Software Engineer
JBoss by Red Hat


More information about the wildfly-dev mailing list