Skip to main content

Unexpected exception caught in MasterTimer.timePulse()--concurrency related

2 replies [Last post]
shahbazc
Offline
Joined: 2008-04-06

I am getting the exception in the subject.

I am running my example in Netbeans 6.5 with JavaFX 1.0 release.

I have a String with an initial value. I bind this text to a text field. In the same script, I change the value of the String and expect the changes to show up correctly in the text field. I change the value of the string more than a 100 times a second, after about a second, I get the exception above.

My script actually connects to a JMS queue and each time a new value is received, a call back method changes the String value.

Apparently, I need to pass all changes through the Swing dispatcher thread...I'm not a swing programmer so I'm not sure how I do that (specifically, how I do that in JavaFX).

The whole point of my script is to read values off jms and display them to a bound text field...once this experiment is successfull, I'll move on to more complex stuff.

How do I solve this?

Thanks

(more of the stack trace):
Unexpected exception caught in MasterTimer.timePulse():
Dispatcher-Channel-1 2008-12-10 12:41:22,943 DEBUG java.lang.NullPointerException
at com.sun.scenario.scenegraph.SGText.getRawBounds(SGText.java:1111)
at com.sun.scenario.scenegraph.SGText.getBounds(SGText.java:985)
at com.sun.scenario.scenegraph.SGNode.calculateAccumBounds(SGNode.java:316)
at com.sun.scenario.scenegraph.SGNode.getTransformedBounds(SGNode.java:302)
at com.sun.scenario.scenegraph.SGNode.accumulateDirty(SGNode.java:902)
at com.sun.scenario.scenegraph.SGFilter.accumulateDirtyChildren(SGFilter.java:184)
at com.sun.scenario.scenegraph.SGNode.accumulateDirty(SGNode.java:904)
at com.sun.scenario.scenegraph.SGWrapper.accumulateDirtyChildren(SGWrapper.java:106)
at com.sun.scenario.scenegraph.SGNode.accumulateDirty(SGNode.java:904)
at com.sun.scenario.scenegraph.SGGroup.accumulateDirtyChildren(SGGroup.java:269)
at com.sun.scenario.scenegraph.SGNode.accumulateDirty(SGNode.java:904)
at com.sun.scenario.scenegraph.SGGroup.accumulateDirtyChildren(SGGroup.java:269)
at com.sun.scenario.scenegraph.SGNode.accumulateDirty(SGNode.java:904)
at com.sun.scenario.scenegraph.JSGPanel.accumulateDirtyRegions(JSGPanel.java:763)
at com.sun.scenario.scenegraph.JSGPanel.repaintDirtyRegions(JSGPanel.java:611)
at com.sun.scenario.scenegraph.JSGPanelRepainter.repaintAll(JSGPanelRepainter.java:106)
at com.sun.scenario.scenegraph.JSGPanelRepainter$FrameDisplay.run(JSGPanelRepainter.java:112)
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:365)
at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:247)
at com.sun.embeddedswing.EmbeddedEventQueue.doPulse(EmbeddedEventQueue.java:470)
at com.sun.embeddedswing.EmbeddedEventQueue.access$000(EmbeddedEventQueue.java:72)
at com.sun.embeddedswing.EmbeddedEventQueue$2.run(EmbeddedEventQueue.java:377)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
michael_heinrichs
Offline
Joined: 2007-11-15

To make code execute on the EDT, you have to use the function FX.deferAction. The parameter is a function. So let's say you want to update a String s, then your code needs to look something like this:

FX.deferAction(function() {s = newValue;});

shahbazc
Offline
Joined: 2008-04-06

Works perfectly!

Thanks