Session Pool Design
1. 利用apache common-pool实现一个Session Pool(非常简单)
2. 如何避免代码中的returnObject()?
xxx() invoke
--------> PoolProxy ---> PoolInterceptor SessionPool
borrowObject()
--------------->
<---------------
xxx() Session (be borr
owed)
-------------------------------->
returnObject()
---------------->
--
RMI design
xxx() invoke Serialize call to remote
-----> ClientProxy ---> RmiInterceptor ------------------->
find ServerProxy, xxx() xxx()
RmiServer----------------> ServerProxy --->....-->ServerObject
Method Cache design
1.用HashMap做cache
xxx() invoke
-----> Proxy ---> MCInterceptor
1. get Attribute @timeout
2. 用object[]作为key,看cache中的
结果是否超时
3. 如果超时 invoke
------------------> NextInterceptor...
4. 如果不超,返回被cache的结果
Draw activity UML diagram:
1. 实现绘图模块
xxx() invoke
---> Proxy ---> ActivityIntercpetor
draw xxx()
--------------->绘图模块
invoke
--------------------------->NextInterceptor...
Persistence and descriptive transaction
1. Persistence直接使用hibernate
xxx invoke
---->Proxy-->HibernateInterceptor
1. 取得@tx,应该为required,requiresnew
,supports,notsupported中的一种
2. 判断当前的transaction状态
3. 决定本次调用是否在transaction当中
Folder-Node关系的复用
getFolder() getFolder() invoke getFolder()
--->UserProxy ------> NodeProxy -->SideEntityInterceptor--> Node
return Folder
<-----
根据Folder创建Group proxy
返回GroupProxy
<----
in the code, like this:
...
User user = userFactory.find("guty"); //user is actually a proxy
Group group = (Group)((Node)user).getFolder();