harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r1028200 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/luni/src/main/java/java/util/Timer.java drlvm/ jdktools/
Date Thu, 28 Oct 2010 06:45:16 GMT
Author: hindessm
Date: Thu Oct 28 06:45:15 2010
New Revision: 1028200

URL: http://svn.apache.org/viewvc?rev=1028200&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@1024556:

  r1024556 | zhoukevin | 2010-10-20 10:10:36 +0100 (Wed, 20 Oct 2010) | 1 line
  
  This patch fixes a problem of which the thread of java.util.Timer should be closed when
VM is off.

Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/util/Timer.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 28 06:45:15 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
+/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963,1024556
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 28 06:45:15 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
+/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963,1024556
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 28 06:45:15 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963,1024556
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/util/Timer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/util/Timer.java?rev=1028200&r1=1028199&r2=1028200&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/util/Timer.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/util/Timer.java
Thu Oct 28 06:45:15 2010
@@ -18,6 +18,8 @@
 package java.util;
 
 import org.apache.harmony.luni.internal.nls.Messages;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * {@code Timer}s are used to schedule jobs for execution in a background process. A
@@ -191,6 +193,11 @@ public class Timer {
          * @param name thread's name
          * @param isDaemon daemon thread or not
          */
+        TimerImpl(boolean isDaemon) {
+            this.setDaemon(isDaemon);
+            this.start();
+        }
+
         TimerImpl(String name, boolean isDaemon) {
             this.setName(name);
             this.setDaemon(isDaemon);
@@ -204,7 +211,7 @@ public class Timer {
         @Override
         public void run() {
             while (true) {
-                TimerTask task;
+                final TimerTask task;
                 synchronized (this) {
                     // need to check cancelled inside the synchronized block
                     if (cancelled) {
@@ -370,6 +377,18 @@ public class Timer {
     	}
         this.impl = new TimerImpl(name, isDaemon);
         this.finalizer = new FinalizerHelper(impl);
+        if (isDaemon) {
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                public Object run() {
+                    Runtime.getRuntime().addShutdownHook(new Thread() {
+                        public void run() {
+                            cancel();
+                        }
+                    });
+                    return null;
+                }
+            });
+        }
     }
     
     /**

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 28 06:45:15 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
+/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963,1024556
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 28 06:45:15 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
+/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963,1024556
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message