mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny (Jira) <j...@apache.org>
Subject [jira] [Closed] (DIRMINA-886) isBrokenConnection
Date Tue, 01 Oct 2019 14:38:00 GMT

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

Emmanuel Lécharny closed DIRMINA-886.
-------------------------------------
    Resolution: Fixed

Formatted the code

> isBrokenConnection
> ------------------
>
>                 Key: DIRMINA-886
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-886
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.4
>            Reporter: jinkai mao
>            Priority: Minor
>              Labels: isBrokenConnection
>             Fix For: 2.0.5
>
>
> class  :org.apache.mina.transport.socket.nio.NioProcessor 
> Method:
> {code:java}
> protected boolean isBrokenConnection() throws IOException 
>   /**
>      * {@inheritDoc}
>      */
>     @Override
>     protected boolean isBrokenConnection() throws IOException {
>         // A flag set to true if we find a broken session
>         boolean brokenSession = false;
>         synchronized (selector) {
>             // Get the selector keys
>             Set<SelectionKey> keys = selector.keys();
>             // Loop on all the keys to see if one of them
>             // has a closed channel
>             for (SelectionKey key : keys) {
>                 SelectableChannel channel = key.channel();
>                 if (((channel instanceof DatagramChannel) && ((DatagramChannel)
channel)
>                         .isConnected())
>                         || ((channel instanceof SocketChannel) && ((SocketChannel)
channel)
>                                 .isConnected())) {
>                     // The channel is not connected anymore. Cancel
>                     // the associated key then.
>                     key.cancel();
>                     // Set the flag to true to avoid a selector switch
>                     brokenSession = true;
>                 }
>             }
>         }
>         return brokenSession;
>     }
>  
> {code}
> --------------------------------------------------------------------------------
> Question: if is need to add ! before ?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org


Mime
View raw message