public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce•org>
To: "Tor Arne Vestbø" <torarnv@gmail•com>
Cc: Robin Rosenberg <robin.rosenberg@dewire•com>, git@vger•kernel.org
Subject: Re: [EGIT PATCH 01/11] Add support code to handle plugin property changes
Date: Thu, 5 Feb 2009 08:40:22 -0800	[thread overview]
Message-ID: <20090205164022.GK26880@spearce.org> (raw)
In-Reply-To: <498B1563.4070905@gmail.com>

Tor Arne Vestbø <torarnv@gmail•com> wrote:
> Shawn O. Pearce wrote:
> > Tor Arne Vestbø <torarnv@gmail•com> wrote:
> >> diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> index fced643..d4a9e8e 100644
> >> --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> @@ -44,9 +48,24 @@
> >>   * This is a plugin singleton mostly controlling logging.
> >>   */
> >>  public class Activator extends AbstractUIPlugin {
> >> +
> >> +	/**
> >> +	 *  The one and only instance
> >> +	 */
> >>  	private static Activator plugin;
> > 
> > What does this field do?  I don't see it referenced anywhere...
> 
> It's the singleton instance, referenced from Activator.getDefault(). I
> just documented it :)

*sigh*.  I haven't had enough caffiene yet this morning.  Yes,
I see what you mean, its only the Javadoc that was added.  OK,
forget I said anything here.  :-)
 
> >>  	/**
> >> +	 * Property listeners for plugin specific events
> >> +	 */
> >> +	private static List<IPropertyChangeListener> propertyChangeListeners =
> >> +		new ArrayList<IPropertyChangeListener>(5);
> > 
> > None of these list accesses are thread-safe.  Are we certain they
> > call will come from a single thread, e.g. the SWT event thread?
> > Or do we need to put synchronized protection in here?
> 
> The addPropertyChangeListener method is called at startup from the
> GitLightweightDecorator constructor, in one of the worker threads, and
> same thing with removePropertyChangeListener from dispose(). The
> broadcastPropertyChange method is called in the main thread every time
> the Git decorator preference page is closes.
> 
> This is the sync model used by other Eclipse plugins for keeping track
> of propertyChangeListeners, for example in the TeamUIPlugin, that's why
> I assumed it was OK. I'm perfectly fine with syncrhronizing it though,
> similar to repositoryChangeListeners in GitProjectData?

OK, I see.  I'd perhaps prefer to make this thread-safe just in case.
If its always coming off the SWT event thread, then just tossing
a synchronized keyword on all 3 methods should be Good Enough(tm).

-- 
Shawn.

  reply	other threads:[~2009-02-05 16:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  1:00 [EGIT PATCH 00/11] Support customizable label decorations Tor Arne Vestbø
2009-02-05  1:00 ` [EGIT PATCH 01/11] Add support code to handle plugin property changes Tor Arne Vestbø
2009-02-05  1:00   ` [EGIT PATCH 02/11] Use Set instead of array to keep track of change listeners Tor Arne Vestbø
2009-02-05  1:00     ` [EGIT PATCH 03/11] Add a specialized team exception for Git Tor Arne Vestbø
2009-02-05  1:00       ` [EGIT PATCH 04/11] Add new class ExceptionCollector for grouping exceptions Tor Arne Vestbø
2009-02-05  1:00         ` [EGIT PATCH 05/11] Add new class SWTUtils with helper-methods for creating controls Tor Arne Vestbø
2009-02-05  1:00           ` [EGIT PATCH 06/11] Implement basic customizable label decorations with preferences Tor Arne Vestbø
2009-02-05  1:00             ` [EGIT PATCH 07/11] Add binding for name of the current branch Tor Arne Vestbø
2009-02-05  1:00               ` [EGIT PATCH 08/11] Add icon decoration for tracked and untracked resources Tor Arne Vestbø
2009-02-05  1:00                 ` [EGIT PATCH 09/11] Implement decorations of dirty, staged, and conflicting resources Tor Arne Vestbø
2009-02-05  1:00                   ` [EGIT PATCH 10/11] Don't decorate every single resource on repository change Tor Arne Vestbø
2009-02-05  1:00                     ` [EGIT PATCH 11/11] Implement label decorations for folders and projects Tor Arne Vestbø
2009-02-05 20:02             ` [EGIT PATCH 06/11] Implement basic customizable label decorations with preferences Robin Rosenberg
2009-02-05 20:21               ` Tor Arne Vestbø
2009-02-05 21:00                 ` Tor Arne Vestbø
2009-02-05 21:36                   ` Robin Rosenberg
2009-02-05 21:44                     ` Tor Arne Vestbø
2009-02-05 20:04             ` Robin Rosenberg
2009-02-05 15:48     ` [EGIT PATCH 02/11] Use Set instead of array to keep track of change listeners Shawn O. Pearce
2009-02-05 16:36       ` Tor Arne Vestbø
2009-02-05 18:28         ` [EGIT PATCH 02/11 v2] " Tor Arne Vestbø
2009-02-05 15:53   ` [EGIT PATCH 01/11] Add support code to handle plugin property changes Shawn O. Pearce
2009-02-05 16:35     ` Tor Arne Vestbø
2009-02-05 16:40       ` Shawn O. Pearce [this message]
2009-02-05 18:22         ` [EGIT PATCH v2] " Tor Arne Vestbø
2009-02-05  1:04 ` [EGIT PATCH 00/11] Support customizable label decorations Tor Arne Vestbø
2009-02-05 16:06 ` Shawn O. Pearce
2009-02-05 16:17   ` Tor Arne Vestbø
2009-02-05 18:32   ` Robin Rosenberg
2009-02-05 18:37     ` Tor Arne Vestbø
2009-02-05 22:09       ` Robin Rosenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090205164022.GK26880@spearce.org \
    --to=spearce@spearce$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=robin.rosenberg@dewire$(echo .)com \
    --cc=torarnv@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox