0

BindUtils.postNotifyChange & JMX NotificationListener

asked 2016-08-09 08:43:50 +0800

tisaksen gravatar image tisaksen
46 6

updated 2016-08-09 08:45:24 +0800

Hi

I have a simple controller which also acts as a JMX Notification Listener. Whenever I get a JMX notification I see the message on the first line of handleNotification(...) logged but setX("whatever") does nothing.

public class MyController implements NotificationListener
{ 
   private String x;

   public void setX(String x) { 
       this.x = x;
   }

   public String getX() {
       return x;
   }

   @Override
   public void handleNotification(Notification n, Object handback)
   {
       LOG.info("handleNotification called");
       setX(n.getMessage()); // supposed to update text on button, but does not.
       // trying to post notifychange event manually
       BindUtils.postNotifyChange(null,null,this,"x");
   }
}

In my zul file I have simply:

<div viewModel="@id('vm') @init('com.foo.MyController')">
    <button label="@load(vm.x)"/>
</div>

So what can be the problem? I think handleNotification might be called on another thread and that's why notifychange does not work?

delete flag offensive retag edit

Comments

If there is no execution, the notify will nog happen. You either need tot implementatie long operationeel for it. Check robert his small talk about long operationeel and his great solution

chillworld ( 2016-08-11 19:31:44 +0800 )edit

Thank you, I will check it out.

tisaksen ( 2016-08-12 13:23:52 +0800 )edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-08-09 08:43:50 +0800

Seen: 40 times

Last updated: Aug 09 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More