Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaϵĿò¼Ü±à³Ì(5)

 



   ·´Éä¡¢ProxyºÍÔªÊý¾ÝÊÇJava×îÇ¿µÄÈý¸öÌØÕ÷£¬ÔÙ¼ÓÉÏCGLib (Code Generation Library)
ºÍASM£¬Ê¹µÃJavaËäȻûÓÐRuby£¬Python°ãºóÉú¿É磬һÑùÄÜ×ö³öÇ¿º·µÄ¿ò¼Ü¡£
   Proxy
¿ÉÒÔ¿´×÷ÊÇ΢Ð͵ÄAOP£¬Ã÷°×ÌṩÁËÔڼ̳кÍίÍÐÖ®ÍâµÄµÚÈý¸ö´úÂë·âװ;¾¶£¬Ö»ÒªÓÐ×ã¹»µÄÏëÏóÁ¦£¬¿ÉÒÔ×öµÃ·Ç³£ºÃÍ棬SpringµÄÔ´ÂëÀïÓÃProxy¾Í
ÓõúÜËæ±ã£¬¿´µÃÎҷdz£Ñۺ졣¿ÉϧProxy±ØÐë»ùÓÚ½Ó¿Ú¡£Òò´ËSpringµÄ×ö·¨£¬»ùÓÚ½Ó¿ÚµÄÓÃproxy,·ñÔò¾ÍÓÃcglib¡£AOPô£¬Ò»°ãСÊ·Ç
compoentÒ»¼¶µÄ¾Í²»Âé·³AspectJ³öÊÖÁË¡£
    cglibµÄEnhancer˵ÆðÀ´ÉñÆ棬ÓÃÆðÀ´Ò»Ò³Ö½²»µ½¾Í½²ÍêÁË¡£
    ËüµÄÔ­Àí¾ÍÊÇÓÃEnhancerÉú³ÉÒ»¸öÔ­ÓÐÀàµÄ×ÓÀ࣬²¢ÇÒÉèÖúÃcallbackµ½proxy£¬ ÔòÔ­ÓÐÀàµÄÿ¸ö·½·¨µ÷Óö¼»áתΪµ÷ÓÃʵÏÖÁËMethodInterceptor½Ó¿ÚµÄproxyµÄintercept() º¯Êý£º
public
 Object intercept(Object o,Method method,Object[] args,MethodProxy proxy)
 ÔÚ
intercept()º¯ÊýÀÄã¿ÉÒÔÔÚÖ´ÐÐObject
result=proxy.invokeSuper(o,args);À´Ö´ÐÐÔ­Óк¯Êý£¬ÔÚÖ´ÐÐÇ°ºó¼ÓÈë×Ô¼ºµÄ¶«Î÷£¬¸Ä±äËüµÄ²ÎÊýÖµ£¬Ò²¿ÉÒÔÂ÷Ìì¹ýº££¬ÍêÈ«
¸É±ðµÄ¡£Ëµ°×ÁË£¬¾ÍÊÇAOPÖеÄaround advice¡£
    AOPûÓгöÏÖÒÔÇ°£¬¸ÃÁìÓò¾­µäµÄÉè¼ÆģʽÊÇDecorator£¬ÏñJava IO StreamµÄÉè¼Æ¾ÍÊÇÈç´Ë.²»¹ý£¬Èç¹ûΪÿ¸öDAO, ÿ¸ö·½·¨µÄдDecoratorº¯Êý»áдËÀÈ˵ģ¬ËùÒÔÓÃÉÏcglibµÄºÃ´¦ÊÇÒ»´Î¹ýÀ¹½ØËùÓз½·¨¡£ 
     ÁíÍ⣬cglib³ýÁËEnhancerÖ®Í⣬»¹ÓÐBulkBeanºÍTransform£¬¶¼ÊÇHibernate³Ö¾Ã»¯µÄ»ù´¡£¬µ«ÎĵµÆ¶·¦£¬Ò»Ê±»¹Ã»È¥¿´ÔõôÓá£
1.AOPÀï½²ÁËÒ»°Ù±é°¢Ò»°Ù±éµÄlog aspectÔÚcglibÊÇÕâÑù×öµÄ:
   
public
 
class
 LogDAOProxy 
implements
 MethodInterceptor
   {
       
private
 Logger log
=
Logger.getLogger(LogDAOProxy.
class
);
       
private
 Enhancer enhancer
=
new
 Enhancer();
        
//
·µ»ØDAOµÄ×ÓÀà
       
public
 Object getDAO(Class&nb


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

Java ÀíÂÛÓëʵ¼ù: ÕýȷʹÓà Volatile ±äÁ¿

 
Java™ ÓïÑÔ°üº¬Á½ÖÖÄÚÔÚµÄͬ²½»úÖÆ£ºÍ¬²½¿é£¨»ò·½·¨£©ºÍ volatile ±äÁ¿¡£ÕâÁ½ÖÖ»úÖƵÄÌá³ö¶¼ÊÇΪÁËʵÏÖ´úÂëÏ̵߳ݲȫÐÔ¡£ÆäÖÐ Volatile ±äÁ¿µÄͬ²½ÐԽϲµ«ÓÐʱËü¸ü¼òµ¥²¢ÇÒ¿ªÏú¸üµÍ£©£¬¶øÇÒÆäʹÓÃÒ²¸üÈÝÒ׳ö´í¡£ÔÚÕâÆÚµÄ Java ÀíÂÛÓëʵ¼ù
ÖУ¬Brian Goetz ½«½éÉܼ¸ÖÖÕýȷʹÓà volatile ±äÁ¿µÄģʽ£¬²¢Õ ......

quartzÒ»·ÖÖÓ½Ì³Ì javaÈÎÎñµ÷¶È

 quartzÊǸÉɶµÄ£¿ ÈÎÎñµ÷¶ÈÓõÄ
ÈÎÎñµ÷¶ÈÊǸÉɶµÄ£¿¾ÍÊÇÔÚÔ¤¶¨µÄʱ¼ä×öÔ¤¶¨µÄÊÂ
1.ÔÚquartÍøÕ¾ÏÂ×îеÄJAR°ü
2.½¨¸öÏîÄ¿£¬°ÑquartzµÄJAR°ü¼ÓÈëµ½ÏîÄ¿
3.н¨Ò»¸öÈÎÎñ
public class MyJob implements org.quartz.Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionExceptio ......

FLEXʹÓÃjavaÁ¬½ÓÊý¾Ý¿â,Éú³ÉtreeÊ÷

×î½ü¼¸Ìì,Ò»Ö±ÔÚÑо¿flex,˵¾äʵÔÚµÄ,ÆäÖеĿàÄÕ²»ÊÇÒ»¾ä»°Á½¾ä»°ÄÜ˵Çå³þµÄ.ûÓнӴ¥¹ý°¡!²»¹ýÏÖÔÚ×ÜËãÊÇ°ÑÊý¾Ý¿âÁ¬ÉÏÁË,×ö³öÁË×Ô¼ºÏëÒªµÄ¶«Î÷.·Ï»°ÉÙ˵,ÏÖÔÚÄØ,ÎҾͰÑÎÒ×öµÄ´úÂëÌù³öÀ´,¸ø´ó¼Ò¿´¿´,¶àÌᱦ¹óÒâ¼û.
ÎÒÓõÄÊÇjdbcµÄÁ¬½Ó·½Ê½(hibernateµÄÁ¬½Ó·½Ê½ÎÒ¿´ÍøÉÏÓÐ,ËùÒԾͲ»Ìù³öÀ´ÁË)
1.flex´úÂë
<?xml version ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ