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

JAVA²¢·¢±à³Ì±Ê¼Ç£¨3£©

Publication and Escape ·¢²¼Ò»¸ö¶ÔÏóÒâζ×ÅÄܹ»´ÓËüÄܹ»´ÓËüµ±Ç°·¶Î§Ö®Íâ±»·ÃÎʵ½¡£±ÈÈ磬±£´æ¿ÉÒÔ±»ÆäËû´úÂëÕÒµ½µÄÕâ¸ö¶ÔÏóµÄÒ»¸öÒýÓ㬻òÕß½«Æä×÷Ϊһ¸ö·Ç˽Óз½·¨µÄ·µ»ØÖµ£¬»òÕß½«Æä×÷Ϊ²ÎÊý´«µÝ¸øÆäËüµÄÀà¡£ public static Set<Secret> knownSecrets;
public void initialize() {
knownSecrets = new HashSet<Secret>();
}
Õâ¸öknownSecrets¾Í±»·¢²¼ÁË£¬²¢ÇÒ£¬knownSecretsÀïÃæÌí¼ÓµÄËùÓÐsecretÒ²¶¼±»·¢²¼³öÈ¥ÁË¡£
class UnsafeStates {
private String[] states = new String[] {
"AK", "AL" ...
};
public String[] getStates() { return states; }
}
Õâ¸östates¾Í±»·¢²¼ÁË£¬¶øÇÒ´øÀ´µÄÎÊÌâÊÇÈκε÷ÓÃÕ߶¼Äܹ»ÐÞ¸ÄÀïÃæµÄÄÚÈÝ£¬ÕâÑù£¬ºÜ²»°²È«¡£
public class ThisEscape {
public ThisEscape(EventSource source) {
source.registerListener(
new EventListener() {
public void onEvent(Event e) {
doSomething(e);
}
});
}
}
¿´Ã÷°×Õâ¸öThisEscapeΪʲô±»·¢²¼ÁËô£¿ÒòΪËü·¢²¼ÁËEventListener£¬¶øÄÚ²¿Àà»á´øÓÐÒ»¸öÒþʽµÄ¶ÔÍⲿÀàµÄÒýÓá£
ÁíÍ⣬ÉÏÃæÕâ¸öÀàµÄÒ»¸öÑÏÖØÎÊÌâÊÇ£¬ÔÚ¹¹Ôì·½·¨ÖÐthisÒýÓÃescapeÁË¡£ÕâÒ²¾ÍÒâζ×ÅÕâ¸ö¶ÔÏóÔÚ±»·¢²¼µÄʱºò»¹´¦ÓÚÒ»¸ö²»ÍêÕûµÄ״̬¡£Ò»¸ö³£¼ûµÄÇéÐξÍÊÇÔÚÀàµÄ¹¹Ôì·½·¨ÖÐÆô¶¯Ò»¸öÏ̡߳£When an object creates a thread from its constructor, it almost always shares its this reference with the new thread, either explicitly (by passing it to the constructor) or implicitly (because the Thread or Runnable is an inner class of the owning object). µ±È»Õâ±¾ÉíûʲôÎÊÌ⣬µ«×îºÃ²»ÒªÔÚ¹¹Ôì·½·¨ÖоÍÆô¶¯Õâ¸öỊ̈߳¬¶øÊÇ°ÑThread.start()·Åµ½Ò»¸öµ¥¶ÀµÄinit·½·¨Öй©ÆäËü¶ÔÏóµ÷Óá£
Òª±ÜÃâ²»ÍêÈ«¹¹ÔìµÄÎÊÌ⣬¿ÉÒÔ²ÉÓÃÏÂÃæµÄ·½Ê½£º
public class SafeListener {
private final EventListener listener;
private SafeListener() {
listener = new EventListener() {
public void onEvent(Event e) {
doSomething(e);
}
};
}
public static SafeListener newInstance(EventSource source) {
SafeListener safe =


Ïà¹ØÎĵµ£º

Berkeley DB JAVA°æ±¾ÖУ¬ÀàÔöÇ¿Æ÷µÄʹÓÃ

¾ÝÎĵµËù˵£¬ÀàÔöÇ¿Æ÷±ÈÓôúÀíµÄ·½Ê½ËÙ¶ÈÉÏÓÐÓÅÊÆ¡£
ÓÐÁ½ÖÖ·½Ê½£¬
µÚÒ»ÖÖÊÇÔÚÀà¼ÓÔØʱ¶¯Ì¬´¦Àí£¬Õâ¸ö¶ÔÏÖÓгÌÐò²»ÓÃÐ޸ġ£Ö»ÐèÒª¸ÄÏÂÔËÐеÄjava½Å±¾¼´¿É
¶ÔÓÚJava 1.5ÈçÏÂËùʾ
java -javaagent:lib/je-<version>.jar=enhance:packageNames ...
je-<version>.jar ¾ÍÊÇBerkeley DB JAVA¿âµÄÃû×Ö¡£ packageNa ......

Mozilla½«Õë¶Ô¶ñÒâJava²å¼þ½øÐÐÆÁ±Î

 ¡¡¡¡¾Ý¹úÍâýÌ屨µÀ£¬MozillaÒѾ­Õë¶ÔFirefoxÉèÖÃÁËÒ»¸ö¶ñÒâJava²å¼þÆÁ±ÎºÚÃûµ¥¡£
¡¡¡¡¾Ý°²È«²©¿ÍBrian Krebs½éÉÜ£¬ÉÏÖܼ׹ÇÎĹ«Ë¾·¢²¼ÁËÒ»¸öÐÞ¸´Java²å¼þ©¶´µÄ¸üУ¬µ«ÊÇMozilla¿ª·¢ÈËÔ±·¢ÏÖ£¬Õâ¸ö¸üÐÂûÓÐɾ³ý¾É°æ±¾µÄ´úÂ룬ʹµÃϵͳÈÔÈ»ÁôÏÂÁË©¶´´úÂ룬´Ó¶øʹµÃÒÅÁô´úÂë³ÉΪеĩ¶´¡£¶Ô´Ë£¬Mozilla²»µÃ²»½«ÆÁ± ......

Java±äÁ¿Êý¾ÝÀàÐÍ

±äÁ¿£º´æ´¢Êý¾ÝµÄ»ù±¾µ¥Ôª£»Ò»¸öÊý¾Ý´æ´¢¿Õ¼äµÄ±íʾ.
»ù±¾Êý¾ÝÀàÐÍ(8ÖÖ)£º
    byte(1)-->short(2)-->int(4)-->long(8)    float(4)-->double(8)   boolean(1)  char(2)
ÒýÓÃÊý¾ÝÀàÐÍ£º
  
   String¡¢Êý×é¡¢Àà¡¢½Ó¿Ú¡¢¶ÔÏó ......

JavaÓïÑÔÖйؼü×Ö½²½â£¨Ò»£©strictfpµÄÓÃ;

×ÔJava2ÒÔÀ´£¬JavaÓïÑÔÔö¼ÓÁËÒ»¸ö¹Ø¼ü×Östrictfp£¬ËäÈ»Õâ¸ö¹Ø¼ü×ÖÔÚ´ó¶àÊý³¡ºÏ±È½ÏÉÙÓ㬵«ÊÇ»¹ÊÇÓбØÒªÁ˽âһϡ£
strictfp µÄÒâ˼ÊÇFP-strict£¬Ò²¾ÍÊÇ˵¾«È·¸¡µãµÄÒâ˼¡£ÔÚJavaÐéÄâ»ú½øÐи¡µãÔËËãʱ£¬Èç¹ûûÓÐÖ¸¶¨strictfp¹Ø¼ü×Öʱ£¬JavaµÄ±àÒëÆ÷ÒÔ¼°ÔËÐл·¾³ÔÚ¶Ô¸¡µãÔËËãµÄ±í´ïʽÊDzÉÈ¡Ò»ÖÖ½üËÆÓÚÎÒÐÐÎÒËصÄÐÐΪÀ´Íê³É ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ