How to avoid race conditions when using PropertyChangeListener and DocumentListener to bind model and GUI?
===

I want to bind a Java Swing JTextField to a String attribute of my data-model.

Therefore I want to use a **PropertyChangeListener** which listens for changes in the text-attribute in the model and then updates the textfield in the GUI (model-->GUI). 

For the other direction (GUI-->model) I want to use a **DocumentListener** on the JTextField's document which should update the model, when the user changes the text in the field.

When I do so, I get a **IllegalStateException** as soon as i change the text in the textfield.

    java.lang.IllegalStateException: Attempt to mutate in notification
	  at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1323)
	  at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:644)
	  at javax.swing.text.JTextComponent.setText(JTextComponent.java:1693)
          ...
	

How can I avoid this?

BTW:
BeansBinding is not really a statisfying solution for me as it is abandoned and in addition I have to instantiate some objects in the object-graph before beeing able to write to them.