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

JAVA¶¯Ì¬´úÀíÄÚ²¿ÊµÏÖ

JAVA¶¯Ì¬´úÀíÄÚ²¿ÊµÏÖ
Ò»¡¡´úÀíÉè¼Æģʽ
´úÀíģʽΪĿ±ê¶ÔÏóÌṩһÖÖ´úÀíÒÔ¿ØÖƶÔʵ¼Ê¶ÔÏóµÄ·ÃÎÊ¡£ÔÚijЩÇé¿öÏ£¬Ò»¸ö¿Í»§²»Ïë»òÕß²»ÄÜÖ±½ÓÒýÓÃÁíÒ»¸ö¶ÔÏ󣬶ø´úÀí¶ÔÏó¿ÉÒÔÔÚ¿Í»§¶ËºÍÄ¿±ê¶ÔÏóÖ®¼äÆðµ½ÖнéµÄ×÷Óá£
ΪÁ˱£³ÖÐÐΪµÄÒ»ÖÂÐÔ£¬´úÀíÀàºÍʵ¼ÊίÍÐÀàͨ³£»áʵÏÖÏàͬµÄ½Ó¿Ú£¬ËùÒÔÔÚ·ÃÎÊÕß¿´À´Á½ÕßûÓÐË¿ºÁµÄÇø±ð¡£
¡¡´úÀíģʽÀàͼ¡¡¡¡
³£¼ûµÄ´úÀíÓÐ:
1) Ô¶³Ì´úÀí(Remote proxy)£º¶ÔÒ»¸öλÓÚ²»Í¬µÄµØÖ·¿Õ¼ä¶ÔÏóÌṩһ¸ö¾ÖÓò´ú±í¶ÔÏó£¬ÈçRMIÖеÄstub¡£¡¡
2)
ÐéÄâ´úÀí(Virtual proxy)£º¸ù¾ÝÐèÒª½«Ò»¸ö×ÊÔ´ÏûºÄºÜ´ó»òÕ߱Ƚϸ´ÔӵĶÔÏó£¬ÑÓ³Ù¼ÓÔØ£¬ÔÚÕæÕýÐèÒªµÄʱºò²Å´´½¨¡£
3) ±£»¤´úÀí(Protect or Access Proxy)£º¿ØÖƶÔÒ»¸ö¶ÔÏóµÄ·ÃÎÊȨÏÞ¡£
4) ÖÇÄÜÒýÓÃ(Smart Reference Proxy)£ºÌṩ±ÈÄ¿±ê¶ÔÏó¶îÍâµÄ·þÎñºÍ¹¦ÄÜ¡£
ͨ¹ý´úÀíÀàÕâÒ»Öмä²ã£¬Äܹ»ÓÐЧ¿ØÖƶÔʵ¼ÊίÍÐÀà¶ÔÏóµÄÖ±½Ó·ÃÎÊ£¬Ò²¿ÉÒԺܺõØÒþ²ØºÍ±£»¤Êµ¼Ê¶Ô£¬ÊµÊ©²»Í¬µÄ¿ØÖƲßÂÔ£¬´Ó¶øÔÚÉè¼ÆÉÏ»ñµÃÁ˸ü´óµÄÁé»îÐÔ¡£
¶þ¡¡¶¯Ì¬´úÀíʹÓÃ
JAVA¶¯Ì¬´úÀí»úÖÆÒÔÇÉÃîµÄ·½Ê½ÊµÏÖÁË´úÀíģʽµÄÉè¼ÆÀíÄî¡£
¶¯Ì¬´úÀíÀàͼ
¶¯Ì¬´úÀíÔÚ´úÀíProxySubjectºÍRealSubjectÖ®¼äÔö¼ÓÁËInvocationHandler£¬ÕâÊÇÒ»ÖÖͨÐżä½Ó»¯£¬
Ôö¼ÓÁËÁé
ÐÔÐÔ£¬ÀýÈç¿ÉÒÔ°ÑÕâ¸öÖмä²ãʵÏÖΪһ¸ö¿ò¼ÜFramework£¬Ö±½Óͨ¹ýxmlÎļþµÈ·½Ê½À´µ÷ÓÃRealSubject¡£
ÔÚÆÕͨµÄÉè¼ÆÖУ¬ÎÒÃÇÒ»°ã²»»áʹÓö¯Ì¬´úÀí¡£µ«ÊÇÔÚһЩ¿ò¼Ü½á¹¹Éè¼ÆÖУ¬¶¯Ì¬´úÀí·Ç³£ÖØÒª£¬ÈçRMI,EJBÖж¼Ê¹Óö¯Ì¬´úÀí¡£
interface Subject
{
public void doSomething();
}
class RealSubject implements Subject
{
public void doSomething()
{
System.out.println( "call doSomething()" );
}
}
class ProxyHandler implements InvocationHandler
{
private Object proxied;

public ProxyHandler( Object proxied )
{
this.proxied = proxied;
}

public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
{
return method.invoke( proxied, args);
}
}
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import sun.misc.ProxyGenerator;
import java.io.*;
public class DynamicProxy
{
public static void main( String args[] )
{
RealSubject real =


Ïà¹ØÎĵµ£º

JavaÖ®¸¸÷öÈ»ÀëÖ° ¿ªÔ´½«ºÎÈ¥ºÎ´Ó

Java´´Ê¼ÈËղķ˹·¸ß˹ÁÖ(James Gosling)ÈÕÇ°ÔÚ²©¿ÍÖгÆ,ÒѾ­ÔÚ4ÔÂ2ÈÕ´Ó¼×¹ÇÎÄ(Oracle£©ÍËÐÝ¡£ºÜ¶àÈ˵ĵÚÒ»·´Ó¦ÊÇ£¬ËûÊÇ·ñ»áͶ±¼Î¢Èí¡¢GoogleÖ®ÀàµÄ¹«Ë¾ÄØ£¿²»¹ýGosling±íʾĿǰ»¹Ã»ÓнøÒ»²½´òËã¡£ 
¹ØÓÚÀëÖ°µÄ¾ßÌåÔ­Òò£¬¸ß˹ÁÖûÓÐ͸¶¡£Ö»ÊÇÔÚ²©¿ÍÖÐдµÀ£º“Êǵģ¬ÄÇЩ´«ÑÔ¶¼ÊÇÕæµÄ£ºÎÒÒѾ­ÔÚÒ»ÖÜÇ°£¨4 ......

java³£¼ûÃæÊÔÌâ

1.ÈçºÎ»ñµÃÊý×éµÄ³¤¶È£¿
Êý×éÃû.length
2.·ÃÎÊÐÞÊηû“public/private/protected/ȱʡµÄÐÞÊηû”µÄʹÓÃÀà?
public : ¹«¹²,¾ù¿É·ÃÎÊ
private: ˽ÓеÄ,ͬһ¸öjavaÀàÖпÉÒÔ·ÃÎÊ.×ÓÀ಻ÄÜ·ÃÎÊ.
protected: ͬһ¸ö°üÖеÄÀ඼¿É·ÃÎÊ.×ÓÀà¿ÉÒÔ·ÃÎÊ.
ȱʡ,friendly :µ±Ç°Àà,ͬһ¸ö°ü,¶¼¿ÉÒÔ·ÃÎÊ.
×÷ÓÃÓò µ± ......

Java֪ʶʰÒÅ£ºÈý´ó¿ò¼ÜµÄ¼¼ÊõÆðÔ´(zz)


Struts¡¢HibernateºÍSpringÊÇÎÒÃÇJava¿ª·¢Öеij£Óùؼü£¬ËûÃÇ·Ö±ðÕë¶Ô²»Í¬µÄÓ¦Óó¡¾°¸ø³ö×îºÏÊʵĽâ¾ö·½°¸¡£µ«ÄãÊÇ·ñÖªµÀ£¬ÕâЩ֪Ãû¿ò¼Ü×î³õÊÇÔõÑù²úÉúµÄ£¿
ÎÒÃÇÖªµÀ£¬´«Í³µÄJava WebÓ¦ÓóÌÐòÊDzÉÓÃJSP+Servlet+JavabeanÀ´ÊµÏֵģ¬ÕâÖÖģʽʵÏÖÁË×î»ù±¾µÄMVC·Ö²ã£¬Ê¹µÄ³ÌÐò½á¹¹·ÖΪ¼¸²ã£¬ÓиºÔðǰ̨չʾµÄJSP¡¢¸ºÔðÁ÷³Ì ......

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë

Ãô½Ý¿ª·¢µÄÀíÄîÒѾ­Á÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾­Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓÚά »¤£¬ÐèÒª½Ï´óµÄ²âÊÔͶÈëºÍÖÜÆÚµÈÎÊÌâ¡£ÕâЩÎÊÌâÔÚÒ»¸öÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ