proxy design pattern,java advanced feature

the proxy design pattern in Java is using everywhere ,but only a handful of people know it. Hibernate for lazy loading entity.Spring for AOP proxy.

the definiton of proxy design:allow object level access control by acting as a pass though entity.it means when at running time ,proxy object can control the behavior of the real object.there are several proxy type:

1 virtual proxy.this proxy can delay the creation and initialization of the exepensive objects when on demands.like image proxy system.as we know ,the high resolution images occupy much momory,if we load  all images at runtime,it is wastful.using virtual proxy,we can have access conrol of the object, just load selected images.

let us take a look at the following features:

a) the high resolution images load only when need,

b) if method is not called,it will never need to load images,so images will not occupy memory.it save a lot of memory ,and improve performance to a great extent

2 remote proxy: the local represention of the remote objects ,like RMI, when in a JVM a object need to communicate with another object in another JVM,we use stub ,the proxy of the remote objects,the stub is charging of call remote objects.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值