[udig-devel] Revision 30214: /udig/trunk/../RenderExecutorComposite.incrementalUpdate()

Jesse Eichar jeichar.w at gmail.com
Thu May 8 07:20:17 PDT 2008


Entirely possible that you are correct tony.  I'm going to walk  
through that code a few times. This could explain an annoying bug I've  
seen.

Jesse

On 8-May-08, at 4:10 PM, Tony Roth wrote:

> hi uDig'gers,
>
> I have a lack of understanding what's going in
> RenderExecutorComposite.incrementalUpdate()
> (package net.refractions.udig.project.internal.render.impl). Could  
> someone
> be patient and tell me why this method was implemented that way?
>
> Entering the method:
> --> getExecutor().resetTimeout() sets 'timeout = 0'. (int 'TIMEOUT'  
> already
> declared with 20000).
> Now every while-loop:
> --> 'start' is initialized with 'long  
> start=System.currentTimeMillis()'.
> After a 'wait_period':
> --> 'timeout' will be increased in a negative way through
> getExecutor().timeout += start-System.currentTimeMillis(); 'timeout'
> decreases, does this make sense?
>
> What about the condition 'getExecutor().timeout < TIMEOUT'?
>
> If the executor-thread is never notified then there will be no way  
> to get
> off the loop. In some cases I have problems to refesh() layers  
> correctly
> after update of content. Exactly then the executor-thread is waiting  
> and
> waiting and waiting....but never refreshes the layer. Am I  
> completely wrong?
>
>
> Revision 30214: /udig/trunk:
> ---------------------------
> public void incrementalUpdate() throws InterruptedException,  
> RenderException
> {
>        getExecutor().resetTimeout(); // int timeout = 0;
>        final int wait_period = 400;
>
>        synchronized (getExecutor()) {
>            getExecutor().inUpdate=true;
>        }
>
>        CompositeRendererImpl renderer2 = getExecutor().getRenderer();
>        synchronized (getExecutor()) {
>        	while( (getMonitor() != null &&!getMonitor().isCanceled())
>        				&& isRendering(renderer2)
>        				&& getExecutor().timeout < TIMEOUT )
> {
>                  long start=System.currentTimeMillis();
>                  getExecutor().wait(wait_period);
>      		getExecutor().timeout += start-System.currentTimeMillis();
>        			if (isRendering(renderer2)) {
>        				renderer2.refreshImage(false);
>        				getExecutor().setState(RENDERING);
>        			}
>        	}
>        }
>        synchronized (getExecutor()) {
>            if( !getMonitor().isCanceled() ){
>           		renderer2.refreshImage();
>        	 }
>             getExecutor().setState(IRenderer.DONE);
>        	 getExecutor().inUpdate=false;
>        }
> }
>
> thanks
> tony
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



More information about the udig-devel mailing list