读书人

Java动态署理机制分析及扩展

发布时间: 2012-09-03 09:48:39 作者: rapoo

Java动态代理机制分析及扩展

最后,见演示程序的执行结果。

清单 21. 执行输出

Ticket Seller Class: class com.demo.proxy.test.TicketSellerProxy0 Ticket Theme: World Expo 2010 Query Ticket Price… >>> Enter method: getTicketPrice <<< Exit method: getTicketPrice Ticket Price: 180 RMB Transaction: Order 1 ticket(s) with 200 RMB >>> Enter method: buy <<< Exit method: buy Transaction: Succeed - Charge is 20 RMB Transaction: Order 1 ticket(s) with 160 RMB >>> Enter method: buy <<< Exit method: buy Transaction: Fail - Money is not enough. Still needs 20 RMB. Transaction: Order 250 ticket(s) with 30000 RMB >>> Enter method: buy <<< Exit method: buy Transaction: Fail - There is no enough ticket available for sale, only 199 ticket(s) left Updating Ticket Theme… Query Updated Ticket Theme… >>> Enter method: getTicketTheme <<< Exit method: getTicketTheme Updated Ticket Theme: World Expo 2010 in Shanghai

读书人网 >编程

热点推荐