mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee (JIRA)" <j...@apache.org>
Subject [jira] Closed: (DIRMINA-384) A possible duplicate event emission in DefaultIoFuture
Date Thu, 07 Jun 2007 09:25:25 GMT

     [ https://issues.apache.org/jira/browse/DIRMINA-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Trustin Lee closed DIRMINA-384.
-------------------------------

    Resolution: Fixed

I reverted back to the 'synchronized' version.

> A possible duplicate event emission in DefaultIoFuture
> ------------------------------------------------------
>
>                 Key: DIRMINA-384
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-384
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.0
>            Reporter: Trustin Lee
>            Assignee: Trustin Lee
>             Fix For: 1.1.1
>
>
> I was reviewing DefaultIoFuture implementation in 1.1 which used CountDownLatch and AtomicBoolean,
and found a possible bug.
> Current implementation:
>    protected void setValue( Object newValue )
>    {
>        if( ready.compareAndSet( false, true ) )
>        {
>            result = newValue;
>            completionLatch.countDown();
>            notifyListeners();
>        }
>    }
>    public void addListener( IoFutureListener listener )
>    {
>        if( listener == null )
>        {
>            throw new NullPointerException( "listener" );
>        }
>        listeners.add( listener );
>        if( ready.get() )
>        {
>            listener.operationComplete( this );
>        }
>    }
> A counter example:
> 1) A user calls the future's addListener().
> 2) addListener() adds the specified listener to the 'listeners'.
> 3) MINA calls the future's setValue(); all listeners including what has just added are
notified.
> 4) ready.get() returns true, so listener.operationComplete() is invoked once again causing
duplicate events.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message