Is it not possibel that updateListeners and
NotationProvider.updateListener is ever called from the AWT thread
also? So we just move the problem somewhere else.
Is there actually an advantage of having those calls on the MDR
thread? Is it a performance issue to take work away from the AWT
thread?
If not then wouldn't it be safer to make sure that everything in that
method is on AWT thread by my suggested change to
FigNodeModelElement/FigEdgeModelElement.
Bob,
On 12/04/2008, Michiel van der Wulp <[EMAIL PROTECTED]> wrote:
> Hi Bob, Christian,
>
> The current code is as follows:
>
> protected void modelChanged(final PropertyChangeEvent mee) {
> super.modelChanged(mee);
> if (mee instanceof AddAssociationEvent
> || mee instanceof RemoveAssociationEvent
> || mee instanceof AttributeChangeEvent) {
> Runnable doWorkRunnable = new Runnable() {
> public void run() {
> renderingChanged();
> updateListeners(getOwner(), getOwner());
> notationProvider.updateListener(
> FigClassifierRole.this, getOwner(), mee);
> damage();
> }
> };
>
> SwingUtilities.invokeLater(doWorkRunnable);
> }
> }
>
>
> But, since the both updateListener calls only are intended to query the
> model, and do not impact the graphic representation, it should be as
> follows:
>
> protected void modelChanged(final PropertyChangeEvent mee) {
> super.modelChanged(mee);
> if (mee instanceof AddAssociationEvent
> || mee instanceof RemoveAssociationEvent
> || mee instanceof AttributeChangeEvent) {
> Runnable doWorkRunnable = new Runnable() {
> public void run() {
> renderingChanged();
> damage();
> }
> };
> updateListeners(getOwner(), getOwner());
> notationProvider.updateListener(
> FigClassifierRole.this, getOwner(), mee);
> SwingUtilities.invokeLater(doWorkRunnable);
> }
> }
>
> IIRC, then this kind of seperating between threads has been discussed
> between me and Tom.
> Please also read the comments with
> NotationProvider.updateListener().
>
> Regards,
> Michiel
>
>
>
>
>
> ----- Original Message ----- From: "Bob Tarling" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Saturday, April 12, 2008 1:48 AM
> Subject: [argouml-dev] modelChanged in Figs should invokeLater
>
>
>
> >
> > Christian came across a problem with concurrency in FigClassifierRole
> > of the new sequence diagrams.
> >
> > The problem was that drawing of a message edge (user interaction an
> > AWT thread) was effecting the Fig composition at the same time as the
> > same Fig was receiving a model event which also resulted in a change
> > to the Fig composition.
> >
> > Forcing the handling of the model event to the AWT thread solved this.
> >
> > I'm thinking that this is probably something we should do in general
> > in Figs to be safe
> >
> > Something like the following in FigNodeModelElement (and Edge)
> >
> > final protected void modelChanged(final PropertyChangeEvent mee) {
> > Runnable doWorkRunnable = new Runnable() {
> > public void run() {
> > modelChangedImpl(mee);
> > }
> > };
> >
> > SwingUtilities.invokeLater(doWorkRunnable);
> > }
> >
> > protected void modelChangedImpl(PropertyChangeEvent
> mee) {
> > // Here goes the code previously in modelChanged
> > }
> >
> >
> > Sound reasonable?
> >
> > Bob.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG.
> > Version: 7.5.519 / Virus Database: 269.22.12/1373 - Release Date:
> 11/04/2008 9:17
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]