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

JavaʱÇøbug£¬TimeZone.setDefault()Ö»ÔÚµ±Ç°Ïß³ÌÓÐЧ

   ÏîÄ¿ÊÇ»ùÓÚGMTʱ¼äµÄ£¬ÔÚϵͳÆô¶¯µÄʱºò£¬ÎÒÃǾͻáµ÷ÓÃTimeZone.setDefault(timeZone)½«Ä¬ÈÏʱÇøÉèΪGMT¡£
   ºóÀ´Í»È»·¢ÏÖ£¬ÓÐʱÓû§Ñ¡ÔñµÄʱ¼ä¾­¹ýºǫ́һȦºó»Ø²úÉú8¸öСʱÎó²î¡£ÓÖÊǼäЪÐԵģ¬ÒªËûÖØÏÖµÄʱºòÓÖÆ«²»À´¡£¿àÐÄdebug£¬ÖÕÓÚ·¢ÏÖÔÚ²¿·ÖÏß³ÌÖУ¬Ê±Çø»¹ÊÇGMT+8£¬ºǫ́ij¸öµ÷ÓÿÉÄÜ°ÑʱÇø±äΪÁËGMT£¬8СʱÎó²î¾Í²úÉúÁË¡£ÍøÉÏÒ»ËÑ£¬Ô­À´ÊÇbug£º
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6352812
Ö»ÔÚ²¿·ÖµçÄÔÉÏÓÐÎÊÌ⣬ÐÒºÃproductionÉÏÊǺõģ¬Ð´ÁËÒ»¸ö³ÌÐòÀ´²âÊÔ£º
import java.util.Date;
import java.util.TimeZone;
public class Test {
  @SuppressWarnings("unused")
  public static void main(String[] args) throws InterruptedException {
    DateThread thread = new DateThread();
    thread.start();
    TimeZone gmt = TimeZone.getTimeZone("GMT");
   
    Date now = new Date();
    System.out.println("main thread,before set timezone:" + now.toString());
    TimeZone.setDefault(gmt);
    Thread.currentThread().sleep(2000);
    thread.resume();
    System.out.println("main thread,after set timezone:" + now.toString());
   
  }
}
class DateThread extends Thread {
  @SuppressWarnings( { "unused", "deprecation" })
  public void run() {
    Date now = new Date();
    System.out.println("sub thread,before set timezone:" + now.toString());
    this.suspend();
    System.out.println("sub thread,after set timezone:" + now.toString());
  }
}
Èç¹û×ÓÏß³ÌÊä³öµÄʱÇøÒ»Ñù£¬¾Í˵Ã÷ÓÐbug


Ïà¹ØÎĵµ£º

JavaÖеĶÑÕ»(°ïÄãÀí½âÄÚ´æÄ£ÐÍ)

JavaÖжÑÕ»µÄ¸ÅÄȻÊÇÂß¼­Éϵģ¬ÔÚÍêÈ«·ûºÏJava¹æ·¶µÄJava´¦ÀíÆ÷ÃæÊÀ֮ǰ£¬ËùÓÐJavaÐéÄâ»úÌṩµÄÄÚÈݶ¼ÊÇÓÉÈí¼þÄ£Äâ³öÀ´µÄ¡£
ʲô½Ð¶Ñ£¿ÄãÓÃÊ®¼¸¸öÂ齫ÅÆÊúÖ±µþ³ÉÒ»ÞûÕâ½Ð¶Ñ£¬Äã¿ÉÒÔ´ÓÉÏÃæ¡¢ÏÂÃæ¡¢ÖмäÈÎÒâ³é³öÒ»ÕÅÅÆ£¬Ò²¿ÉÒÔÈÎÒâ²åÈëÒ»ÕÅ¡£
ʲô½ÐÕ»£¿AK-47µÄµ¯Ï»¾ÍÊÇÒ»¸öÕ»£¬ÔÚÉÏÃæµÄ×Óµ¯Ã»±»È¡³ö֮ǰ£¬ÄãÎÞ·¨È¡³öÏÂà ......

Java×ÀÃ濪·¢±Ê¼Ç

      ÐèÒª×öÒ»¸ö×ÀÃæµÄС¶«Î÷£¬ÓÉÓÚÖÁ½ñΪֹֻ»áдJava£¬ËùÒÔÖ»ÓÐÓÃswingÀ´×öÁË¡£ÅóÓÑ˵Delphi×öÆðÀ´ºÜ¿ì£¬µ«ÎÒûʱ¼äȥѧÁË£¬Ò»¶¨Òª¿ªÊ¼ºáÏò·¢Õ¹ÁË¡£
     Ô­À´¶ÌÔݵÄ×ö¹ýNetBeansµÄrcp¿ª·¢£¬µ«ËüµÄ´úÂë×éÖ¯Óеã¹ýÓÚ¸´ÔÓ£¬²»¹ýÎÒÒª×öµÄ²»ÊǺܴóµÄ¶«Î÷£¬µ«»¹ÊÇÏëÏÈÕÒEclips ......

java³ÌÐòÔ±Ó¦¸Ã¾­³£ä¯ÀÀµÄÍøÕ¾£¨¾­µäÍƼö£¬¸öÈËÊղأ©

ÍøÕ¾ÁбíÈçÏ£º
 
IBMÖйúµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/
 
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/java/  ÖÐÎÄ
 
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/java  Ó¢ÎÄ
 
Google´úÂëĿ¼ÍøÕ¾£ºhttp://c ......

java ±àдº¯Êý ½»»»Á½¸ö»ù±¾±äÁ¿µÄÖµ

Java±àдһ¸öº¯Êý½»»»Á½¸ö±äÁ¿µÄÖµ
Javaº¯ÊýÔÚ´«µÝ¹ý³ÌÖÐÖ»Äܹ»´«Öµ£¬²»ÄÜ´«Ö·¡£ÕâÑù£¬º¯ÊýµÄ²ÎÊýÔÚº¯ÊýÄÚ²¿×öÈκα仯¾Í¶¼²»»á·´Ó³µ½Íⲿµ÷ÓÃÕßÀ´¡£ËùÒÔ½â¾öÖ®µÀ¾ÍÊÇÒªÕÒµ½Òª½»»»¶ÔÏóµÄÒýÓ᣶ÔÓÚÆÕͨµÄÖµÀàÐÍ£¬Ïñint»òÕßdoubleÕâÑùµÄ¿ÉÒԸĴ«ËûÃǵİü×°ÀàIntegerºÍDouble¡£¶ø¶ÔÓÚ±¾À´¾ÍÊÇÒýÓÃÀàÐ͵ĶÔÏó£¬ÔòÐèÒª¶ÔËûÃÇÔÙ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ