`

关于Quick Server的Object Pool解读

阅读更多
  Quick Server (1.4.6 版本)的对象池是交给org.quickserver.net.server.PoolManager管理的,框架中其唯一的实现类是org.quickserver.net.server.impl.BasicPoolManager。
   先看下quick server的配置文件中关于 object-pool的配置项:
<object-pool>
<max-active>..</max-active>
<max-idle>..</max-idle>
<init-size>..</init-size>
<thread-object-pool>
..		
</thread-object-pool>
<client-handler-object-pool>
..
</client-handler-object-pool>
<byte-buffer-object-pool>
..
</byte-buffer-object-pool>		
<client-data-object-pool>
..
</client-data-object-pool>
</object-pool>

其中可配置4种对象池,如果不对4种池专门配置,则共享<object-pool>的max-active、max-idle、init-size参数值。4种池是相互独立的。看BasicPoolManager源码:
public ObjectPool makeByteBufferPool(PoolableObjectFactory factory, PoolConfig opConfig)
/*    */   {
/* 36 */     GenericObjectPool.Config bconfig = new GenericObjectPool.Config();
/* 37 */     bconfig.maxActive = opConfig.getMaxActive();
/* 38 */     bconfig.maxIdle = opConfig.getMaxIdle();
/* 39 */     bconfig.whenExhaustedAction = 1;
/* 40 */     return new GenericObjectPool(factory, bconfig);
/*    */   }
/*    */ 
/*    */   public ObjectPool makeClientPool(PoolableObjectFactory factory, PoolConfig opConfig)
/*    */   {
/* 45 */     GenericObjectPool.Config bconfig = new GenericObjectPool.Config();
/* 46 */     bconfig.maxActive = opConfig.getMaxActive();
/* 47 */     bconfig.maxIdle = opConfig.getMaxIdle();
/* 48 */     bconfig.whenExhaustedAction = 0;
/* 49 */     return new GenericObjectPool(factory, bconfig);
/*    */   }
/*    */ 
/*    */   public ObjectPool makeClientHandlerPool(PoolableObjectFactory factory, PoolConfig opConfig)
/*    */   {
/* 54 */     GenericObjectPool.Config bconfig = new GenericObjectPool.Config();
/* 55 */     bconfig.maxActive = opConfig.getMaxActive();
/* 56 */     bconfig.maxIdle = opConfig.getMaxIdle();
/*    */ 
/* 58 */     bconfig.whenExhaustedAction = 0;
/* 59 */     return new GenericObjectPool(factory, bconfig);
/*    */   }
/*    */ 
/*    */   public ObjectPool makeClientDataPool(PoolableObjectFactory factory, PoolConfig opConfig)
/*    */   {
/* 64 */     GenericObjectPool.Config bconfig = new GenericObjectPool.Config();
/* 65 */     bconfig.maxActive = opConfig.getMaxActive();
/* 66 */     bconfig.maxIdle = opConfig.getMaxIdle();
/* 67 */     bconfig.whenExhaustedAction = 0;
/* 68 */     return new GenericObjectPool(factory, bconfig);
/*    */   }

ClientPool,ClientHandlerPool,ClientDataPool,ByteBufferPool4种池对象都是org.apache.commons.pool.impl.GenericObjectPool的实例。GenericObjectPool是抽象类BaseObjectPool的子类,其池基于org.apache.commons.collections.CursorableLinkedList实现,是List的一个实现。
分享到:
评论

相关推荐

    quick server

    里面有详细的开发文档,及quick server服务器程序

    Quick Server 入门教程

    QuickServer的类似软件 - 网络工具包 - 开源中国社区 QuickServer 是一个免费的开源Java库,用于快速创建健壮的多线程、多客户端TCP服务器应用程序。使用QuickServer,用户可以只集中处理应用程序的逻辑/协议。

    Quick Easy FTP Server V4.0.0

    Quick Easy FTP Server V4.0.0 一键架设服务器,让本机成为服务器

    Quick Easy FTP Server 4.0.0

    简单小巧的ftpserver,Quick Easy FTP Server

    Quick Easy FTP Server V4.0.0.zip

    全中文FTP服务器

    Python库 | quick_server-0.3.0-py2-none-any.whl

    python库,解压后可用。 资源全名:quick_server-0.3.0-py2-none-any.whl

    Quick Easy FTP Server V4.0.0 简体中文绿色免费版

    Quick Easy FTP Server V4.0.0 简体中文绿色免费版

    Quick Easy Ftp Server扫描软件

    Quick Easy Ftp Server扫描软件

    Quick’n Easy Web Server Pro v3.3.5

    Quick’n Easy Web Server可以轻松设置个人web服务器了,将文件复制到任意目录,选择网页默认目录后网站就能运行了,可用于搭建个人 Web 服务器,或用于测试 ASP/CGI/PHP 网站程序,类似于大家使用的 IIS 和 ...

    Quick 'n Easy Mail Server

    Quick 'n Easy Mail Server 非常值得收藏的 简单方便的邮箱服务器

    Quick Easy FTP Server 3.9.1.zip

    Quick Easy FTP Server 是一个全中文FTP服务器软件,反应迅速,操作方便,实现了标准FTP服务器所具有的功能

    Quick Easy FTP Server v4.00.zip

    Quick Easy FTP Server是一个小巧的中文FTP服务器软件,绿色单文件,反应迅速,操作方便,实现了标准FTP服务器所具有的功能。 Quick Easy FTP Server软件具有以下特点: 1.软件安装程序极小,但性能毫不逊色于专业...

    Quick Easy FTP Server

    Quick Easy FTP Server 是一个全中文FTP服务器软件,反应迅速,操作方便,实现了标准FTP服务器所具有的功能

    全中文FTP服务器 Quick Easy FTP Server V4.0.0单文件版

    全中文FTP服务器 Quick Easy FTP Server V4.0.0单文件版 Quick Easy FTP Server是一个全中文FTP服务器软件,反应迅速,操作方便,实现了标准FTP服务器所具有的功能 软件介绍: 软件具有以下特点: 1.软件安装...

    Quick'n Easy FTP Server

    临时要架FTP站, 找不到方法吗? Quick'n Easy FTP Server可以帮上大忙, 简单好用的FTP架站软件

    quick easy web server

    非常简单的web服务器,支持asp。免安装绿色版,就一个文件,运行它并作简单设置就可以了,非常实用,。我在Vista basic版上自建了服务器用于调试asp站点,并建了主页将自己的收藏夹都整理上去,很方便的

    Quick Pool

    Quick Pool is a simple tool that allows to avoid Instantiate and Destroy calls.

    Quick Easy Ftp Server

    FTP 服务器端软件,绿色无需安装 。压缩包,没有密码。

Global site tag (gtag.js) - Google Analytics