Session Pool Design 利用apache commonpool实现一个Session Pool(非常简单) 如何避免代码中的returnObject()? xxx()invoke > PoolProxy > PoolInterceptorSessionPool 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应该为requiredrequiresnew supportsnotsupported中的一种 判断当前的transaction状态 决定本次调用是否在transaction当中 FolderNode关系的复用 getFolder() getFolder() invokegetFolder() >UserProxy > NodeProxy >SideEntityInterceptor> Node return Folder < 根据Folder创建Group proxy 返回GroupProxy < in the code like this:
User user = userFactoryfind(guty); //user is actually a proxy Group group = (Group)((Node)user)getFolder(); |