ÉîÈëÁ˽âJava ClassLoader¡¢Bytecode ¡¢ASM¡¢cglib
Ò»¡¢Java ClassLoader
1£¬Ê²Ã´ÊÇClassLoader
Óë C »ò C++ ±àдµÄ³ÌÐò²»Í¬£¬Java ³ÌÐò²¢²»ÊÇÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬¶øÊÇÓÉÐí¶à¶ÀÁ¢µÄÀàÎļþ×é³É£¬Ã¿Ò»¸öÎļþ¶ÔÓ¦ÓÚÒ»¸ö Java Àà¡£
´ËÍ⣬ÕâЩÀàÎļþ²¢·ÇÁ¢¼´È«²¿¶¼×°ÈëÄڴ棬¶øÊǸù¾Ý³ÌÐòÐèҪװÈëÄÚ´æ¡£ClassLoader ÊÇ JVM Öн«Àà×°ÈëÄÚ´æµÄÄDz¿·Ö¡£
¶øÇÒ£¬Java ClassLoader ¾ÍÊÇÓà Java ÓïÑÔ±àдµÄ¡£ÕâÒâζ×Å´´½¨Äú×Ô¼ºµÄ ClassLoader ·Ç³£ÈÝÒ×£¬²»±ØÁ˽â JVM µÄ΢Сϸ½Ú¡£
2£¬Ò»Ð©ÖØÒªµÄ·½·¨
A)loadClass
ClassLoader.loadClass() ÊÇClassLoaderµÄÈë¿Úµã¡£¸Ã·½·¨µÄ¶¨ÒåΪ£ºClass loadClass( String name, boolean resolve );
name£ºJVM ÐèÒªµÄÀàµÄÃû³Æ£¬Èç Foo »ò java.lang.Object¡£
resolve£º²ÎÊý¸æËß·½·¨ÊÇ·ñÐèÒª½âÎöÀà¡£
B)defineClass
defineClass·½·¨ÊÇClassLoaderµÄÖ÷Òª¾÷ÇÏ¡£¸Ã·½·¨½ÓÊÜÓÉÔʼ×Ö½Ú×é³ÉµÄÊý×é²¢°ÑËüת»»³ÉClass¶ÔÏó¡£
C)findSystemClass
findSystemClass·½·¨´Ó±¾µØÎļþϵͳÖÐÑ°ÕÒÀàÎļþ£¬Èç¹û´æÔÚ£¬¾ÍʹÓÃdefineClass½«Ôʼ×Ö½Úת»»³ÉClass¶ÔÏó£¬ÒÔ½«¸ÃÎļþת»»³ÉÀà¡£
D)resolveClass
¿ÉÒÔ²»ÍêÈ«µØ(²»´ø½âÎö)×°ÈëÀ࣬Ҳ¿ÉÒÔÍêÈ«µØ(´ø½âÎö)×°ÈëÀà¡£µ±±àдÎÒÃÇ×Ô¼ºµÄloadClassʱ¿ÉÒÔµ÷ÓÃresolveClass£¬ÕâÈ¡¾öÓÚloadClassµÄresolve²ÎÊýµÄÖµ¡£
E)findLoadedClass
findLoadedClass³äµ±Ò»¸ö»º´æ£ºµ±ÇëÇóloadClass×°ÈëÀàʱ£¬Ëüµ÷Óø÷½·¨À´²é¿´ClassLoaderÊÇ·ñÒÑ×°ÈëÕâ¸öÀ࣬ÕâÑù¿ÉÒÔ±ÜÃâÖØÐÂ×°ÈëÒÑ´æÔÚÀàËùÔì³ÉµÄÂé·³¡£
3£¬Java2ÖÐClassLoaderµÄ±ä¶¯
1)loadClassµÄȱʡʵÏÖ
ÔÚJava2ÖÐloadClassµÄʵÏÖǶÈëÁË´ó¶àÊý²éÕÒÀàµÄÒ»°ã·½·¨£¬²¢Ê¹Äúͨ¹ý¸²¸ÇfindClass·½·¨À´¶¨ÖÆËü£¬ÔÚÊʵ±µÄʱºòfindClass»áµ÷ÓÃloadClass¡£
ÕâÖÖ·½Ê½µÄºÃ´¦ÊÇ¿ÉÄܲ»Ò»¶¨Òª¸²¸ÇloadClass£¬Ö»Òª¸²¸ÇfindClass¾ÍÐÐÁË£¬Õâ¼õÉÙÁ˹¤×÷Á¿¡£
2)з½·¨:findClass
loadClassµÄȱʡʵÏÖµ÷ÓÃÕâ¸öз½·¨¡£
3)з½·¨:getSystemClassLoader
Èç¹û¸²¸ÇfindClass»òloadClass£¬getSystemClassLoaderÈÃÎÒÃÇÒÔʵ¼ÊClassLoader¶ÔÏóÀ´·ÃÎÊϵͳClassLoader£¬¶ø²»Êǹ̶¨µÄ´ÓfindSystemClass µ÷ÓÃËü¡£
4)з½·¨:getParent
ΪÁ˽«ÀàÇëÇóίÍиø¸¸ClassLoader£¬Õâ¸öз½·¨ÔÊÐíClassLoader»ñÈ¡ËüµÄ¸¸ClassLoader¡£
4£¬¶¨ÖÆClassLoader
ÆäʵÎÒÃÇ»ò¶à»òÉÙ¶¼Ê¹Óùý¶¨ÖƵÄClassLoader£¬ÒòΪApplet²é¿´Æ÷ÖоͰüº¬Ò»¸ö¶¨ÖƵÄClassLoader¡£
Ëü²»ÔÚ±¾µØÎļþϵͳÖÐÑ°ÕÒÀ࣬¶øÊÇ·ÃÎÊÔ¶³Ì·þÎñÆ÷ÉϵÄ
Ïà¹ØÎĵµ£º
public class bubblesort {
public static void main(String[] args) {
int array[]=new int[]{1,5,9,4,6,2};
int m;
for(int i=0;i<array.length;i++){
System.out.print(arra ......
ÊÂÎñ´¦Àí×ܽá
À´Ô´£ºhttp://space.itpub.net/13956325/viewspace-598381
Ò»¡¢Ê²Ã´ÊÇJava ÊÂÎñ
ͨ³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿â Ïà¹Ø¡£
Ê Îñ±ØÐë·þ´ÓISO/IECËùÖƶ¨µÄACIDÔÔò¡£ACIDÊÇÔ×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ £¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ×ÓÐÔ±íʾÊÂÎñ ......
Ò».ÔÚj2seÀïÎÒÃÇ¿ÉÒÔʹÓÃMath.random()·½·¨À´²úÉúÒ»¸öËæ»úÊý£¬Õâ¸ö²úÉúµÄËæ»úÊýÊÇ0-1Ö®¼äµÄÒ»¸ödouble£¬ÎÒÃÇ¿ÉÒÔ°ÑËû³ËÒÔÒ»¶¨µÄÊý£¬±ÈÈç˵³ËÒÔ100£¬Ëû¾ÍÊǸö100ÒÔÄÚµÄËæ»ú£¬Õâ¸öÔÚj2meÖÐûÓС£
¶þ.ÔÚjava.utilÕâ¸ö°üÀïÃæÌṩÁËÒ»¸öRandomµÄÀ࣬ÎÒÃÇ¿ÉÒÔн¨Ò»¸öRandomµÄ¶ÔÏóÀ´²úÉúËæ»úÊý£¬Ëû¿ÉÒÔ²úÉúËæ»úÕûÊý¡¢Ëæ»úfloat¡¢ ......
±ÊÕßÔÚJava¿ª·¢Öг£³£»áÓöµ½½«Êý¾Ý¿âÊý¾Ýµ¼³öµ½ExcelµÄÒªÇ󣬱ÈÈçÔÚÎÒµÄÒ»¸öÏîÄ¿ÖУ¬¿Í»§ÒªÇóËùÓвéѯ½á¹û¶¼¿ÉÒÔµ¼³öµ½Excel£¬¶ÔÓÚÊý¾ÝÁ¿²»´óµÄ£¨¼¸ÍòÌõ£©£¬Õâ±È½ÏÈÝÒ×ʵÏÖ£¬µ«¶ÔÓÚÊý¾ÝÁ¿±È½Ï´óµÄ£¨¼¸Ê®Íò¼°ÒÔÉÏ£¬¾ßÌåÒª¿´µ¼³öÄÚÈݵÄ×ֶθöÊýºÍ³¤¶Ì£©£¬ÔòÔÚÊý¾Ý¿â²éѯºÍÉú³ÉexcelÎļþÉ϶¼»áÓÐÂé·³¡£
ÒÔÎÒÔÚʵ¼ÊÏîÄ¿ÖеÄÒ»¸ ......