Can I add listeners/publisher subscriber to JAXB objects?

265 views Asked by At

I have a multithreaded application using JAXB. The JAXB object represent state of other system hardware. I have a thread monitoring the system hardware, and it updates the JAXB objects with the setters to update the state.

I have another chunk of code that is supposed to "do something" when the state of an object changes. I'm wondering how to set up event listeners, or some sort of publisher subscriber scheme, so that when a JAXB object changes state, the appropriate response to the change is kicked off. I have not seen anything describing how something could register as a listener with a JAXB object.

1

There are 1 answers

2
bdoughan On

JAXB objects are just POJOs, so you can modify the code to add listeners appropriate to your use case.