Jody Garnett wrote:
> In order to report on Progress (at all), let alone decompose Progress 
> into bite sized chunks as we delegate to different methods ... we need 
> to somehow let the Callable communicate with the outside world... 
> basically it needs a reference to the Future that is "watching" it.
>
> Does anyone have ideas on this one?
> Jody
>   
I have just tried recasting the question; basically Callable has no 
ability to report on progress; the goal is only to stop the Callable 
using a Future. The following adapter does this just fine ...

    public static Callable<Map<String,Object>> callable( String name, 
Map<String,Object> input  ){
        final Process process = process( name, input );
        return new Callable<Map<String,Object>>(){
            public Map<String, Object> call() throws Exception {
                process.process( new ThreadProgressListener() );
                return process.getResult();
            }           
        };
    }

Where:

public class ThreadProgressListener extends NullProgressListener {
    public boolean isCanceled() {       
        return Thread.currentThread().isInterrupted();
    }
}

Is this sufficient for your needs Martin? I am sorry but we have the 
hard and fast requirement to report on Progress as it happens (both for 
the Eclipse Jobs API and for the the WPS specification).

Jody

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to