Return-Path: X-Original-To: apmail-harmony-commits-archive@www.apache.org Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 56FA673FF for ; Sun, 30 Oct 2011 12:05:54 +0000 (UTC) Received: (qmail 17454 invoked by uid 500); 30 Oct 2011 12:05:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 17405 invoked by uid 500); 30 Oct 2011 12:05:53 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 17398 invoked by uid 99); 30 Oct 2011 12:05:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2011 12:05:53 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2011 12:05:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 41B91328697 for ; Sun, 30 Oct 2011 12:05:32 +0000 (UTC) Date: Sun, 30 Oct 2011 12:05:32 +0000 (UTC) From: "dafeng (Commented) (JIRA)" To: commits@harmony.apache.org Message-ID: <345275704.38207.1319976332270.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <350023530.38040.1319961452276.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HARMONY-6690) java.lang.InheritableThreadLocal didn't set java.lang.Thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HARMONY-6690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13139605#comment-13139605 ] dafeng commented on HARMONY-6690: --------------------------------- The case to test inherited threadlocal =================== package second; public class TestThreadLocal { public static void main(String[] args) { TestThreadLocal ttl=new TestThreadLocal(); final InheritableThreadLocal t=new InheritableThreadLocal(); A a1=ttl.new A(t,"a1"); A a2=ttl.new A(t,"a2"); a1.start(); a2.start(); try{ Thread.currentThread().sleep(1000); }catch(Exception e){ e.printStackTrace(); } synchronized(a1){ a1.notify(); } synchronized(a2){ a2.notify(); } System.out.println(t.get()); } class A extends Thread{ ThreadLocal t; String value; public A(ThreadLocal t,String value){ this.t=t; this.value=value; } @Override public void run() { t.set(value); try{ synchronized(this){ this.wait(); } }catch(Exception e){ e.printStackTrace(); } System.out.println(t.get()); Thread z=new Thread(){ @Override public void run() { System.out.println("inh"); System.out.println(t.get()); } }; z.start(); } } } > java.lang.InheritableThreadLocal didn't set java.lang.Thread > ------------------------------------------------------------- > > Key: HARMONY-6690 > URL: https://issues.apache.org/jira/browse/HARMONY-6690 > Project: Harmony > Issue Type: Bug > Components: Classlib > Affects Versions: 5.0M15 > Environment: all > Reporter: dafeng > Priority: Minor > > /harmony/enhanced/java/trunk/drlvm/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadLocal.java > uses localValues field of thread. InheritableThreadLocal should use inheritableValues in initValues() and > values() method. > ============= > Thread: > 157 /* > 158 * ThreadLocal values: local and inheritable > 159 * > 160 */ > 161 ThreadLocal.Values localValues; > 162 ThreadLocal.Values inheritableValues; > ================ > ThreadLocal: > 100 /** > 101 * Creates Values instance for this thread and variable type. > 102 */ > 103 Values initializeValues(Thread current) { > 104 return current.localValues = new Values(); > 105 } > 106 > 107 /** > 108 * Gets Values instance for this thread and variable type. > 109 */ > 110 Values values(Thread current) { > 111 return current.localValues; > 112 } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira