Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 72868 invoked from network); 5 Dec 2006 16:53:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2006 16:53:42 -0000 Received: (qmail 80445 invoked by uid 500); 5 Dec 2006 16:53:49 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 80200 invoked by uid 500); 5 Dec 2006 16:53:48 -0000 Mailing-List: contact dev-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 dev@harmony.apache.org Received: (qmail 80191 invoked by uid 99); 5 Dec 2006 16:53:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 08:53:48 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [212.159.14.213] (HELO ptb-relay02.plus.net) (212.159.14.213) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 08:53:35 -0800 Received: from [87.112.75.228] (helo=[192.168.0.2]) by ptb-relay02.plus.net with esmtp (Exim) id 1GrdXa-0000Pd-8k for dev@harmony.apache.org; Tue, 05 Dec 2006 16:53:10 +0000 Message-ID: <4575A440.60608@tackline.plus.com> Date: Tue, 05 Dec 2006 16:54:24 +0000 From: Thomas Hawtin User-Agent: Thunderbird 1.5.0.4 (X11/20060602) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: [-SPAM-] RE: [classlib][swing] an odd code in swing References: <8E389A5F2FEABA4CB1DEC35A25CB39CE7DC014@mssmsx411> In-Reply-To: <8E389A5F2FEABA4CB1DEC35A25CB39CE7DC014@mssmsx411> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Ivanov, Alexey A wrote: > I think synchronized block can be safely removed. > Any way Swing is not thread-safe, and these methods are not explicitly > marked as thread-safe. This is a static mutable variables [bad]. In an environment where there are multiple 'AppContexts', such as Applets, it may be accessed by multiple threads. >> From: Mikhail Loenko [mailto:mloenko@gmail.com] >> >> javax.swing.Timer >> >> this is an attomic operation, why synchronized? That is not a valid argument. One issue is that the change would not necessarily visible to other threads if not synchronized/volatile. Secondly, if there are other non-atomic operation using synchronized, then these may fail. However, in this case volatile looks fine, and no-one would really notice if even that was not present. >> public static void setLogTimers(final boolean isLogTimers) { >> synchronized (Timer.class) { >> Timer.isLogTimers = isLogTimers; >> } >> } Tom Hawtin