You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/04/18 09:33:15 UTC

[jira] Resolved: (DIRMINA-370) More atomic operations for user defined session attributes.

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

Trustin Lee resolved DIRMINA-370.
---------------------------------

    Resolution: Fixed

I checked in the new methods.  Please review.

> More atomic operations for user defined session attributes.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-370
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-370
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Trustin Lee
>         Assigned To: Trustin Lee
>            Priority: Trivial
>             Fix For: 2.0.0-M1
>
>
> MINA 1.1 and above uses ConcurrentHashMap in IoSession.  ConcurrentMap has more atomic operations than just Map; replace w/ oldValue, remove w/ value, and putIfAbsent.  We could expose these operations in IoSession, too.
> A good example of the usage of these methods is ProtocolCodecFilter.getDecoderLock().
>     private Object getDecoderLock( IoSession session )
>     {
>         Object lock = session.getAttribute( DECODER_LOCK );
>         if( lock == null )
>         {
>             lock = new Object();
>             session.setAttribute( DECODER_LOCK, lock );
>         }
>         return lock;
>     }
> We could remove the possibility of returning different locks without a synchronized block.
>     private Object getDecoderLock( IoSession session )
>     {
>         Object lock = session.getAttribute( DECODER_LOCK );
>         if( lock == null )
>         {
>             lock = session.setAttributeIfAbsent( DECODER_LOCK, new Object() );
>         }
>         return lock;
>     }

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