Java Dynamic Proxy
import java.lang.reflect.*;
public class A extends Thread {
public static void main(String[] args) throws Exception{
CC cc = new CC();
HH hh = new HH(cc);
II ii = (II) Proxy.newProxyInstance(HH.class.getClassLoader(),
new Class[]{II.class},
hh);
System.out.println ("" + ii.getClass().getName());
ii.test();
}
}
interface II {
void test();
}
class CC implements II {
public void test() {
System.out.println ("this is cc");
}
}
class HH implements InvocationHandler {
Object obj;
HH(Object obj) {
this.obj = obj;
}
public Object invoke(Object obj, Method m, Object[] args) throws Exception {
System.out.println ("start");
Object o = m.invoke(this.obj, args);
System.out.println ("end");
return o;
}
}
ÔËÐÐʱ¼ÓÈë -Dsun.misc.ProxyGenerator.saveGeneratedFiles=true£¬¿ÉÒԵõ½proxy class¡£
²Î¿¼£ºhttp://www.javablogging.com/what-is-java-dynamic-proxies-api/
Ïà¹ØÎĵµ£º
ºÜ¶àÈËÕâÑùÎÊ£¬JAVAÔõôѧѽ£¿Ó¦¸Ã¿´Ê²Ã´Êéѽ£¿
ÀÏʵ˵¸öÈËÀ´Ëµ£¬Êé¿´µÃ²»¶à£¬¿ªÊ¼µÄʱºò¾Í¿´Á˱¾ sam's teach yourself Java2 in 24 hours.
ËùÒÔÎÊÆðÕâЩÎÊÌâ£¬Õæ²»ºÃ˵,ÿ¸öÈ˶¼²»Ò»Ñù.
×ܵÄÀ´Ëµ,ÎÒ¾õµÃÊǶàÁ·Ï°ÊǺÜÖØÒªµÄ,
²»Òª¿´Ì«¶àÊéÒ»±¾¾Í¿ÉÒÔÁË,µ«Á·Ï°Ò»¶¨Òª¶à×ö,
ѧϰÊÇÒ»¸öÄ£·ÂµÄ¹ý³Ì,
Ä£·ÂµÄ¹ý³ÌÖл¹Òª²» ......
/*****************Animal.java begin ***********************/
public class Animal{
public void jj(){
}
public static void main(String args[]){
//±àÒëʱÀàÐÍ //ÔËÐÐʱÀàÐÍ
Animal anima ......
If the requested address is not a valid virtual memory address (it doesn't belong to any of
the memory segments of the executing process), the page cannot be validated, and
a segmentation fault is generated. This vectors control to another part of the kernel and
usually results in the pro ......
Ê×ÏÈÁ˽âÏÂËùνµÄjava nioÊǸöʲô¶«Î÷£¡
IOÊÇ¿¿×Ö·û»ò×Ö½Ú½øÐд«Ê䣬±È½ÏÂý£¡ ¶øNIOÊÇ¿¿¿é£¬ Ò²¾ÍÏ൱ÓÚÒ»¸öBuffer£¬ Ò»¿éÒ»¿é
µÄ´«Ê䣬 ËٶȽϿì
£¡ ͬʱ¼ÓÈëÁ˶àÏß³Ì
µÄ¿ØÖÆ£¬ Ò»¸öNIOÁ÷¿ÉÒÔͬʱ´«Êä¶à¸ö¿éµÈ£¬ Ò²¾ÍÊÇËùνµÄÒì²½´«Êä
£»
´«Í³
µÄ²¢·¢ÐÍ
·þÎñÆ÷Éè¼ÆÊÇÀûÓÃ×èÈûÐÍÍøÂçI/O
ÒÔ¶àÏ̵߳ÄÄ ......