2014年2月19日

ActiveMQ源码分析

摘要: 对于Consumer的setMessageListener中的MessageListenerActiveMQMessageConsumer::setMessageListener public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); if (info.getPrefetchSize() == 0) { throw new JMSException( ... 阅读全文

posted @ 2014-02-19 11:31 starfuxks 阅读(600) 评论(0) 推荐(0)

2014年2月8日

mq

摘要: Activemq一开始就是persistance的。用的replicated levelDB store性能的影响方面有topologyprotocolsTransport Connectorswire protocol : openWiretcpnio:large number of clients, heavy network traffic to the brokernio creates fewer threads and tcp connectionshttp(s):cross the firewallvm connector:performance. hard to maintai 阅读全文

posted @ 2014-02-08 18:01 starfuxks 阅读(213) 评论(0) 推荐(0)

2014年1月22日

duoxiancheng

摘要: 保护性拷贝(defensive copy)package com.starfuxks;import java.util.Date;public class PseudoDefensiveCopyClass { private Date date; public PseudoDefensiveCopyClass(Date date) { this.date = date; } public Date getDate() { return date; }}表面上看,这个类的private变量无法被修改。但实际上是错误的,ge... 阅读全文

posted @ 2014-01-22 21:37 starfuxks 阅读(132) 评论(0) 推荐(0)

2014年1月20日

对象池

摘要: 对象池Object pool基本思路:1. 继承PoolableObjectFactory的工厂类,用来“制造”相应的Object2. 创建一个ObjectPool用borrowObject和returnObject来进行对象“归还”和“借用” 阅读全文

posted @ 2014-01-20 18:30 starfuxks 阅读(162) 评论(0) 推荐(0)

2014年1月13日

lazy_initialization

摘要: 1. 最简单的thread-safe的getInstance。效率最差,每次都要检查intrinsic lock,即便是sequence的单线程调用,也耗时巨大测试结果:在我的台式机上单线程的调用,运行999999999次需要时间11250毫秒以上,correct but expensivepublic synchronized ClassName getInstance() {if (instance == null)instance = new ClassName();return instance;}2. double-checked lockingvolatile关键字的应用。还有ca 阅读全文

posted @ 2014-01-13 14:27 starfuxks 阅读(198) 评论(0) 推荐(0)

导航