Re: [JPP-Devel] Question? - rendering

2007-05-23 Thread Michaël Michaud

>Larry, Michael: Did somebody change the zoombar behaviour - so that it 
>starts zoom on release and not in between, when the bar is still moved?
>
>This would be necessary if we take over the rendering improvements from 
>skyjump - otherwise it may stop the system for some minutes because it 
>re-renders every bar step trigger.
>  
>
Hi,
I tested the zoombar on my windows desktop, and get no problem with or 
without Larry's improvements.
I tested it with a 190 000 objects  layer
While moving the cursor, I get gray outlines of my objects scaling very 
fast, and when I release the mouse, it starts rendering with exact 
appearance. I think this is the normal behaviour.
If you tell me the conditions under which you observed long delays 
before the final display, I'll investigate further.
Changes are now commited and can be tested

regards,

Michael

>stefan
>
>BTW: i would like to thank you: Larry, Michael and Sascha and the 
>others.. you start now talking about important mods, where i dont have a 
>clue what you are actually talking about (i am not a IT guy ;o)
>BTW: i plan to submit my thesis by mid-end of june.. so then i will have 
>more time again
>
>Larry Becker schrieb:
>  
>
>>Michaël,
>>
>>  I agree that PlugInContext is probably not appropriate in the model.  
>>I changed mine to WorkbenchContext since SkyJUMP no longer allows Task 
>>Cloning because it was buggy.  Now that I think of it, the bugs might 
>>have been related to the issue of disposing of cloned references.
>>
>>regards,
>>Larry
>>
>>On 5/22/07, *Michaël Michaud* <[EMAIL PROTECTED] 
>>> wrote:
>>
>>Larry Becker a écrit :
>>
>> > Michaël,
>> >Looks like a good plan on the SkyJUMP+OpenJUMP+Synchronization
>>wiki
>> > page.  The priorities seem reasonable to me given OJ's goals.  The
>> > decimation optimization is implicit in line:  points =
>> > j2D.toViewCoordinates (linestring.getCoordinates());  since that just
>> > calls the previously modified routine.
>>
>>Thanks, one of my next tasks, for sure
>>
>> > Maybe (Layer layer) should be (Object contentID) in: public void
>> > removeLayerRenderer(Layer layer){
>>
>>Seems a good idea, I'll follow this advice
>>
>>I tested your fix and found one bad case :
>>If you cloned your task (don't know if you kept this feature in
>>SkyJUMP), there still may be a memory leak
>>
>>Here's how I fixed it in LayerManager
>>
>>// Firstly, I changed PlugInContext to WorkbenchFrame in the signature
>>//because I think a class in the model package should no use a class
>>from
>>//plugin package (may be not important...)
>>public void dispose(WorkbenchFrame frame, Layerable layerable) {
>>// removing ALL LayerRenderers for this Layer
>>JInternalFrame[] internalFrames = frame.getInternalFrames ();
>>for (int i = 0 ; i < internalFrames.length ; i++) {
>>JInternalFrame internalFrame = internalFrames[i];
>>if (internalFrame instanceof LayerViewPanelProxy) {
>>((LayerViewPanelProxy)internalFrame).getLayerViewPanel()
>>
>>.getRenderingManager()
>>
>>.removeLayerRenderer(layerable);
>>}
>>}
>>
>>Michaël
>>
>> >
>> > Larry
>> >
>> >
>> > On 5/21/07, *Michaël Michaud* < [EMAIL PROTECTED]
>>
>> > >>> wrote:
>> >
>> > Hi,
>> >
>> > > Hi Michaël,
>> > >You are one step ahead of me.  I had just reached the same
>> > > conclusion and did the mods to remove the references and it
>>worked.
>> >
>> > You are a step ahead of me because I still have to do the
>>mods ;-)
>> > Thanks for giving classes to modify
>> >
>> > Do you know that I started to compile the mods you did in
>>skyjump on
>> > http://openjump.org/wiki/show/SkyJUMP+-+OpenJUMP+Synchronization
>> >
>>>> ?
>> > and I did my first synchro yesterday with the union plugin...
>> > Maybe I'll have question if I go on with more complex
>>improvements...
>> >
>> > Sunburned, here is a 5 minutes tutorial for heap analysis :
>> >
>>http://blog.emptyway.com/2007/04/02/finding-memory-leaks-in-java-apps/
>> >
>> > Michaël
>> >
>> > > The mods are:
>> > >
>> > > In RemoveSelectedLayersPlugin:
>> > >   public boolean execute(PlugInContext context) throws
>>Exception {
>> > > remove(context, (Layerable[])
>> > > ( context.getLayerNamePanel()).selectedNodes(
>> > >
>> > > In LayerManager:
>> > >  

[JPP-Devel] SourceForge problems

2007-05-23 Thread Larry Becker

I have been having problems with accessing the openjump repository on
SourceForge for the last hour.  Is anyone else having issues?

If I keep trying, I eventually get it to work, but it is taking way too long
to update my copy of OJ.  I will check back with it tomorrow.

regards,
Larry

--
http://amusingprogrammer.blogspot.com/
<>-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Problem building OpenJUMP 1.2 B from source. ("de" Package Import Problems?)

2007-05-23 Thread Sunburned Surveyor
Michael,

I think the problem was with the way I had the project configured in
Eclipse. I've been having some problems with it properly recognizing
all of the packages on the build path.

Thank you for your help.

Landon

On 5/21/07, Michael Brüning <[EMAIL PROTECTED]> wrote:
> Hi Sunburned,
>
> the file listed is part of the PIROL classes that Stefan integrated a
> while ago. The source code should be there in the corresponding package
> folder, so this should not be a problem with a missing jar, as the
> source for these classes is included in the source code archives. Have
> you added these sources to the project that you're building from?
>
> Hope I could give you a hint in the right direction.
>
> Take care,
> Michael
>
> Sunburned Surveyor schrieb:
> > I'm having some trouble building the OpenJUMP 1.2 B release from
> > source code. I'm getting import error statements in most of the "de"
> > packages. For example, the following import statement raises a flag:
> >
> > import de.fho.jump.pirol.utilities.debugOutput.DebugUserIds;
> >
> > I've configured my build path in Eclipse to include all of the JAR
> > files provided in the /lib filder of the release. Am I missing a JAR
> > file that will resolve the import statement errors?
> >
> > Thanks,
> >
> > The Sunburned Surveyor
> >
> > -
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
>
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] SourceForge problems

2007-05-23 Thread Sunburned Surveyor
Larry,

I tried to update my OpenJUMP project in Eclipse. (It is linked to the
OpenJUMP CVS on SourceForge.)

This was taking a very, very long time. I finally gave up and I have
tried it again.

The Sunburned Surveyor

On 5/23/07, Larry Becker <[EMAIL PROTECTED]> wrote:
> I have been having problems with accessing the openjump repository on
> SourceForge for the last hour.  Is anyone else having issues?
>
> If I keep trying, I eventually get it to work, but it is taking way too long
> to update my copy of OJ.  I will check back with it tomorrow.
>
> regards,
> Larry
>
> --
> http://amusingprogrammer.blogspot.com/
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Problem building OpenJUMP 1.2 B from source. ("de" Package Import Problems?)

2007-05-23 Thread Stefan Steiniger
dont forget to check if you have the libs/projects specified in the 
built options of the project AND the "run" options

stefan

Sunburned Surveyor schrieb:
> Michael,
> 
> I think the problem was with the way I had the project configured in
> Eclipse. I've been having some problems with it properly recognizing
> all of the packages on the build path.
> 
> Thank you for your help.
> 
> Landon
> 
> On 5/21/07, Michael Brüning <[EMAIL PROTECTED]> wrote:
>> Hi Sunburned,
>>
>> the file listed is part of the PIROL classes that Stefan integrated a
>> while ago. The source code should be there in the corresponding package
>> folder, so this should not be a problem with a missing jar, as the
>> source for these classes is included in the source code archives. Have
>> you added these sources to the project that you're building from?
>>
>> Hope I could give you a hint in the right direction.
>>
>> Take care,
>> Michael
>>
>> Sunburned Surveyor schrieb:
>>> I'm having some trouble building the OpenJUMP 1.2 B release from
>>> source code. I'm getting import error statements in most of the "de"
>>> packages. For example, the following import statement raises a flag:
>>>
>>> import de.fho.jump.pirol.utilities.debugOutput.DebugUserIds;
>>>
>>> I've configured my build path in Eclipse to include all of the JAR
>>> files provided in the /lib filder of the release. Am I missing a JAR
>>> file that will resolve the import statement errors?
>>>
>>> Thanks,
>>>
>>> The Sunburned Surveyor
>>>
>>> -
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> ___
>>> Jump-pilot-devel mailing list
>>> Jump-pilot-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>
>>
>> -
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> ___
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
> 
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> 
> 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Problem building OpenJUMP 1.2 B from source. ("de" Package Import Problems?)

2007-05-23 Thread Sunburned Surveyor
Thanks for that tip Stefan.

SS

On 5/23/07, Stefan Steiniger <[EMAIL PROTECTED]> wrote:
> dont forget to check if you have the libs/projects specified in the
> built options of the project AND the "run" options
>
> stefan
>
> Sunburned Surveyor schrieb:
> > Michael,
> >
> > I think the problem was with the way I had the project configured in
> > Eclipse. I've been having some problems with it properly recognizing
> > all of the packages on the build path.
> >
> > Thank you for your help.
> >
> > Landon
> >
> > On 5/21/07, Michael Brüning <[EMAIL PROTECTED]> wrote:
> >> Hi Sunburned,
> >>
> >> the file listed is part of the PIROL classes that Stefan integrated a
> >> while ago. The source code should be there in the corresponding package
> >> folder, so this should not be a problem with a missing jar, as the
> >> source for these classes is included in the source code archives. Have
> >> you added these sources to the project that you're building from?
> >>
> >> Hope I could give you a hint in the right direction.
> >>
> >> Take care,
> >> Michael
> >>
> >> Sunburned Surveyor schrieb:
> >>> I'm having some trouble building the OpenJUMP 1.2 B release from
> >>> source code. I'm getting import error statements in most of the "de"
> >>> packages. For example, the following import statement raises a flag:
> >>>
> >>> import de.fho.jump.pirol.utilities.debugOutput.DebugUserIds;
> >>>
> >>> I've configured my build path in Eclipse to include all of the JAR
> >>> files provided in the /lib filder of the release. Am I missing a JAR
> >>> file that will resolve the import statement errors?
> >>>
> >>> Thanks,
> >>>
> >>> The Sunburned Surveyor
> >>>
> >>> -
> >>> This SF.net email is sponsored by DB2 Express
> >>> Download DB2 Express C - the FREE version of DB2 express and take
> >>> control of your XML. No limits. Just data. Click to get it now.
> >>> http://sourceforge.net/powerbar/db2/
> >>> ___
> >>> Jump-pilot-devel mailing list
> >>> Jump-pilot-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>>
> >>
> >> -
> >> This SF.net email is sponsored by DB2 Express
> >> Download DB2 Express C - the FREE version of DB2 express and take
> >> control of your XML. No limits. Just data. Click to get it now.
> >> http://sourceforge.net/powerbar/db2/
> >> ___
> >> Jump-pilot-devel mailing list
> >> Jump-pilot-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >
> > -
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
>
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] OpenJUMP is rendering Strings? Very interesting...

2007-05-23 Thread Sunburned Surveyor

I was finally able to figure out why I was getting a
NullPointerException in my pluggable rendering code. It is becuase
OpenJUMP is attempting to render Java String objects. (At least that
is what it looks like to me.)

My code returns a NullPointerException when it encounters one of these
Strings because I didn't design it to return a Renderer objecct for
Strings.

Here is how I found out what was happening. I added some logging
statements using log4j in the LayerViewPanel.repaint() method. I knew
that this was the source of the NullPointerException. I also suspected
that OpenJUMP was passing me something other that a Layer or WMSLayer
to render. So I modified the LayerViewPanel.repaint() method to loop
through the List of ContentIDs, or objects to be rendered. I think
printed the class name of each object in the List. After I found out
that the objects causing me problems were Strings, I modified the
logging statements in the repaint() method to also print out the value
of the Strings.

The Strings that are present in the List of objects to be rendered
when OpenJUMP first starts have the following values:

SELECTION_BACKGROUND
SELECTED_FEATURES
SELECTED_LINESTRINGS
SELECTED_PARTS
GRID
SCALE_SHOW
SCALE_BAR

Isn't this odd? Those Strings almost look like Constant values. I
wonder where in the world they are coming from?

I've attached a text file that contains the logging statements I put
into the modified LayerViewPanel.repaint() method. I have also
attached the log file that contains the text from the logging
statements.

I can modify my pluggable rendering system to ignore String objects,
but I'd really like to know how they end up in the ContentIDs List to
begin with. Thank you in advance for any suggestions or insight.

The Sunburned Surveyor

P.S. - I just found a new friend. His name is log4j. :]
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_PARTS
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_PARTS
DEBUG - The String has a value of: SELECTED_PARTS
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: GRID
DEBUG - The String has a value of: GRID
DEBUG - The String has a value of: GRID
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The String has a value of: SELECTION_BACKGROUND
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The String has a value of: SELECTED_FEATURES
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The String has a value of: SELECTED_LINESTRINGS
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't find a renderer for was: java.lang.String
DEBUG - The class we couldn't f

Re: [JPP-Devel] OpenJUMP is rendering Strings? Very interesting...

2007-05-23 Thread Larry Becker

SS,

   public RenderingManager(final LayerViewPanel panel) {
   this.panel = panel;
   repaintTimer.setCoalesce(true);
   putAboveLayerables(SelectionBackgroundRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new SelectionBackgroundRenderer(panel);
   }
   });
   putAboveLayerables(FeatureSelectionRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new FeatureSelectionRenderer(panel);
   }
   });
   putAboveLayerables(AuditNonDupSelectionRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new AuditNonDupSelectionRenderer(panel);
   }
   });
   putAboveLayerables(AuditDupSelectionRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new AuditDupSelectionRenderer(panel);
   }
   });
   putAboveLayerables(LineStringSelectionRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new LineStringSelectionRenderer(panel);
   }
   });
   putAboveLayerables(PartSelectionRenderer.CONTENT_ID,
   new Renderer.Factory() {
   public Renderer create() {
   return new PartSelectionRenderer(panel);
   }
   });
   }

regards,
Larry

On 5/23/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote:


I was finally able to figure out why I was getting a
NullPointerException in my pluggable rendering code. It is becuase
OpenJUMP is attempting to render Java String objects. (At least that
is what it looks like to me.)

My code returns a NullPointerException when it encounters one of these
Strings because I didn't design it to return a Renderer objecct for
Strings.

Here is how I found out what was happening. I added some logging
statements using log4j in the LayerViewPanel.repaint() method. I knew
that this was the source of the NullPointerException. I also suspected
that OpenJUMP was passing me something other that a Layer or WMSLayer
to render. So I modified the LayerViewPanel.repaint() method to loop
through the List of ContentIDs, or objects to be rendered. I think
printed the class name of each object in the List. After I found out
that the objects causing me problems were Strings, I modified the
logging statements in the repaint() method to also print out the value
of the Strings.

The Strings that are present in the List of objects to be rendered
when OpenJUMP first starts have the following values:

SELECTION_BACKGROUND
SELECTED_FEATURES
SELECTED_LINESTRINGS
SELECTED_PARTS
GRID
SCALE_SHOW
SCALE_BAR

Isn't this odd? Those Strings almost look like Constant values. I
wonder where in the world they are coming from?

I've attached a text file that contains the logging statements I put
into the modified LayerViewPanel.repaint() method. I have also
attached the log file that contains the text from the logging
statements.

I can modify my pluggable rendering system to ignore String objects,
but I'd really like to know how they end up in the ContentIDs List to
begin with. Thank you in advance for any suggestions or insight.

The Sunburned Surveyor

P.S. - I just found a new friend. His name is log4j. :]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel






--
http://amusingprogrammer.blogspot.com/
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] A new ThreadQueue ...

2007-05-23 Thread Sascha L. Teichmann
Hi together,

as some of you may already know i have my dislikes against
ThreadQueue [1] (Hi, Larry!) see my mail [2]

a - It forks a new thread for any Runnable it processes.
b - It has an ugly busy wait loop inside.
c - The event listener for empty queue fires to often.
d - The default ThreadQueue is some kind of thread serializer.
e - The DB/WMS ThreadQueue has no public access.

Now I've written a sub class of ThreadQueue: SingleThreadQueue
(see attachment). This one deals with the issues a, b and d.
I also attached a patch against RenderingManager [3] to handle e.

The new class (to be placed in package
com.vividsolutions.jump.workbench.ui.renderer) is a drop-in
replacement for the default ThreadQueue in RenderingManager.
Not for the ThreadQueue that handles the DB/WMS layers.

Because Jon limited the number of parallel threads in default
queue to 1 I see no reason why to fork a new thread for each
Runnable it processes. Thread creation/shutdown is fairly
expensive. Instead a single background thread is started
which processes the Runnables one by one. If the thread
is idle for 30 secs it shuts itself down. If you have a lot
of (non-WMS/BB) layers this should improve performance
and save some resources. The processing itself is done
with a monitor (synchronized/wait/notify) so there is no
busy wait any more.

The DB/WMS ThreadQueue (real parallel threads) is left untouched
for the moment. Depending on my personal schedule I will send
a patch against this one too. Preliminary code with thread pooling
exists but it needs a bit more testing.

Find attached the new class and patches against RenderingManager and
the old ThreadQueue to bring it to work.

Comments are very welcome. :-)

Kind regrads,
  Sascha

[1] com.vividsolutions.jump.workbench.ui.renderer.ThreadQueue
[2]
http://sourceforge.net/mailarchive/message.php?msg_name=4653389E.6000706%40intevation.de
[3] com.vividsolutions.jump.workbench.ui.renderer.RenderingManager
Index: ./src/com/vividsolutions/jump/workbench/ui/renderer/RenderingManager.java
===
RCS file: 
/cvsroot/jump-pilot/openjump/src/com/vividsolutions/jump/workbench/ui/renderer/RenderingManager.java,v
retrieving revision 1.6
diff -u -r1.6 RenderingManager.java
--- ./src/com/vividsolutions/jump/workbench/ui/renderer/RenderingManager.java   
22 May 2007 18:47:12 -  1.6
+++ ./src/com/vividsolutions/jump/workbench/ui/renderer/RenderingManager.java   
24 May 2007 04:10:30 -
@@ -77,7 +77,7 @@
 * non-database layers in parallel. In fact, it will make the GUI less
 * responsive. [Jon Aquino]
 */
-   private ThreadQueue defaultRendererThreadQueue = new ThreadQueue(1);
+   private ThreadQueue defaultRendererThreadQueue = new 
SingleThreadQueue();
 
/**
 * WMS and database processing are done on the server side, so allow 
these
@@ -294,6 +294,10 @@
return defaultRendererThreadQueue;
}
 
+   public ThreadQueue getMultiRendererThreadQueue() {
+   return multiRendererThreadQueue;
+   }
+
public void dispose() {
repaintTimer.stop();
defaultRendererThreadQueue.dispose();
@@ -334,4 +338,4 @@
 contentIDToRendererMap.remove(contentID);
 }
 
-}
\ No newline at end of file
+}
Index: ./src/com/vividsolutions/jump/workbench/ui/renderer/ThreadQueue.java
===
RCS file: 
/cvsroot/jump-pilot/openjump/src/com/vividsolutions/jump/workbench/ui/renderer/ThreadQueue.java,v
retrieving revision 1.1
diff -u -r1.1 ThreadQueue.java
--- ./src/com/vividsolutions/jump/workbench/ui/renderer/ThreadQueue.java
16 Jun 2005 22:50:38 -  1.1
+++ ./src/com/vividsolutions/jump/workbench/ui/renderer/ThreadQueue.java
24 May 2007 04:09:15 -
@@ -47,6 +47,10 @@
 private Vector queuedRunnables = new Vector();
 private int maxRunningThreads;
 
+   public ThreadQueue() {
+   this(1);
+   }
+
 public ThreadQueue(final int maxRunningThreads) {
 this.maxRunningThreads = maxRunningThreads;
 }
@@ -95,7 +99,7 @@
 public static interface Listener {
 public void allRunningThreadsFinished();
 }
-private void fireAllRunningThreadsFinished() {
+protected void fireAllRunningThreadsFinished() {
//new ArrayList to avoid ConcurrentModificationException [Jon Aquino]
 for (Iterator i = new ArrayList(listeners).iterator(); i.hasNext(); ) {
 Listener listener = (Listener) i.next();
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; witho