Session Pool Design
利用apache common
pool實現一個Session Pool(非常簡單)
如何避免代碼中的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
用HashMap做cache
xxx() invoke
> Proxy
> MCInterceptor
get Attribute @timeout
用object[]作為key
看cache中的
結果是否超時
如果超時 invoke
> NextInterceptor
如果不超
返回被cache的結果
Draw activity UML diagram:
實現繪圖模塊
xxx() invoke
> Proxy
> ActivityIntercpetor
draw xxx()
>繪圖模塊
invoke
>NextInterceptor
Persistence and descriptive transaction
Persistence直接使用hibernate
xxx invoke
>Proxy
>HibernateInterceptor
取得@tx
應該為required
requiresnew
supports
notsupported中的一種
判斷當前的transaction狀態
決定本次調用是否在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();
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19673.html