You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2009/05/26 16:21:46 UTC
[jira] Closed: (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 ]
Emmanuel Lecharny closed DIRMINA-370.
-------------------------------------
> 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
> Assignee: 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 )
> {
> session.setAttributeIfAbsent( DECODER_LOCK, new Object() );
> lock = session.getAttribute( DECODER_LOCK );
> }
> return lock;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.