Re: [OpenMap Users] Day/Night Layer garbage collection

From: Don Dietrick <dietrick_at_bbn.com>
Date: Wed, 8 Feb 2006 10:10:03 -0500

Hi Chase,

Thanks for the updates, I'll incorporate them into the code base.

- Don

On Feb 6, 2006, at 12:36 PM, Chase Barrett wrote:

> Hello All,
>
>
>
> We’ve discovered that when we dispose of a map that includes the
> day/night layer, the disposed map is never garbage collected. This
> is because one or more Timer objects have the disposed map
> registered as a listener, and the map is therefore reachable by
> reference from an active thread.
>
>
>
> We’ve also noticed that if you attempt to update the refresh rate
> by calling setProperties() with an updated refresh property, the
> new Timer kicks in as expected, but the old Timer still kicks off
> refresh events according to the old refresh rate. Updating the
> refresh rate with a call to setTimer() has no effect on the refresh
> events, unless the outside caller also adds the layer as a listener
> to the new Timer.
>
>
>
> For those interested, these are the changes we made to
> com.bbn.openmap.layer.daynight.DayNightLayer to address these
> problems:
>
>
>
> 1) Modified setTimer(Timer):
>
>
>
> Replaced:
>
>
>
> public void setTimer(Timer t) {
>
> timer = t;
>
> }
>
>
>
> With:
>
>
>
> public synchronized void setTimer(Timer t) {
>
> if (timer != null)
>
> {
>
> timer.removeActionListener(this);
>
> }
>
> timer = t;
>
> if ((timer != null) && (timer.getDelay() > 0))
>
> {
>
> timer.addActionListener(this);
>
> }
>
> }
>
>
>
> 2) Modified setProperties(String, Properties):
>
>
>
> Replaced:
>
>
>
> if (updateInterval > 0) {
>
> timer = new Timer(updateInterval, this);
>
> }
>
>
>
> With:
>
>
>
> setTimer(new Timer(updateInterval, null));
>
>
>
> 3) Add an override for removed(Container):
>
>
>
> public void removed(Container cont)
>
> {
>
> super.removed(cont);
>
> setTimer(null);
>
> }
>
>
>
>
>
> Hope this helps,
>
>
>
> Chase
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Feb 08 2006 - 10:10:19 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT