美文网首页
学习Note

学习Note

作者: 码头军 | 来源:发表于2017-07-28 09:43 被阅读0次

Mina deadlock判断:

在DefaultIoFuture类中,checkDeadLock方法:

in DefaultIoFuture the deadlock detection algorithm, the strategy is in two steps, first is a simple and rapid method to detect, and then use a more accurate method to detect. The first method to obtain the current thread by getStackTrace the entire stack of array of elements, then iterate the array to see if there is a layer called the class is AbstractPollingIoProcessor, if any, is the existence of cycles is called deadlock. This is because to achieve IoProcessor AbstractPollingIoProcessor abstract class that contains an Executor, create a thread processing tasks,

在mina的官方API文档里,在介绍IoFilter时,有这么一句话:

Please NEVER implement your filters to wrapIoSessions.Users can cache the reference to the session, which might malfunction if any filters are added or removed later.

https://mina.apache.org/mina-project/apidocs/index.html

这个是什么意思呢?为何不建议定制filters to wrap IoSession?

The filter is removed from the chain if onPostAdd(IoFilterChain, String, org.apache.mina.core.filterchain.IoFilter.NextFilter)threw an exception. destroy()is also invoked by ReferenceCountingFilter if the filter is the last filter which was added to IoFilterChains. ???

如果是IoFilterChain上的最后一个filter,则调用destroy()方法。

IoService接口管理一个service下的所有session,使用Map用来存储session信息。

public interface IoService {

...

/**

*@returnthe map of all sessions which are currently managed by this

* service.  The key of map is the {@linkIoSession#getId() ID} of the

* session. An empty collection if there's no session.

*/

Map getManagedSessions();

...

}

IoAcceptor代表服务器端,接收客户端的connection,调用handler处理events。

IoConnector代表客户端,连接服务器端,调用handler处理events。

IoAcceptor和IoConnector都extends IoService。

相关文章

  • 2020-02-23

    一英语学习总结 文档:2020-02-23.note 链接:http://note.youdao.com/note...

  • 帮助学习的工具积累

    学习方法: Forest APP Flat tomato One note Microsoft Note maki...

  • 学习Note

    Mina deadlock判断: 在DefaultIoFuture类中,checkDeadLock方法: in D...

  • 2020-02-12

    一、英语学习总结 文档:2020-02-12.note 链接:http://note.youdao.com/not...

  • 2020-02-17

    一、英语学习总结 文档:2020-02-17.note 链接:http://note.youdao.com/not...

  • 2020-02-16

    一、英语学习总结 文档:2020-02-16.note 链接:http://note.youdao.com/no...

  • 2020-02-14

    一、英语学习总结: 文档:2020-02-14.note 链接:http://note.youdao.com/n...

  • NetSuite SuiteScript Map Reduce

    NetSuite SuiteScript Map Reduce Script Learning Note学习笔记 ...

  • 深度学习Note

    记录一下个人看了王小草深度学习笔记之后的理解,目录如下, Overview 先来看看人工智能Artificial ...

  • MXNet安装

    mxnet学习笔记,安装. Note:This blog without all the resources th...

网友评论

      本文标题:学习Note

      本文链接:https://www.haomeiwen.com/subject/cmnyfxtx.html