Re: ProgressMonitor takes too long to display in Sun's ProgressMonitorDemo



Skip,

I appreciate your advice. I tried adding a yield() call in the
ActualTask and also tried lowering the worker thread's priority to
Thread.MIN_PRIORITY. However, neither had any effect on how quickly
the ProgressMonitor displayed.

Are there any other suggestions on how to get the ProgessMonitor to
display more quickly?

For your information, the ActualTask's constructor is as follows:

ActualTask() {
//Fake a long task,
//making a random amount of progress every second.
//Thread.currentThread().yield();
while (!canceled && !done) {
try {
Thread.sleep(10000);
current += Math.random() * 100; //make some progress
if (current >= lengthOfTask) {
done = true;
current = lengthOfTask;
}
statMessage = "Completed " + current +
" out of " + lengthOfTask + ".";
} catch (InterruptedException e) {
System.out.println("ActualTask interrupted");
}
}
}

Skip wrote:
> <abbomb@xxxxxxxxxxx> wrote in message
> news:1120002374.520310.294150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Why does it take so long for the ProgressMonitor to display in this
> > case? How do I get it to display immediately? Note that I have tried
> > using the ProgressMonitor.setMillisToDecideToPopup method but it has no
> > effect.
>
> Your thread might be so cpu-intensive that the cpu doesn't have much cycles
> left to initiate that GUI. You might want to either lower the
> thread-priority a bit, or Thread.yield() a couple of times in your
> worker-thread.

.



Relevant Pages

  • Re: ProgressMonitor takes too long to display in Suns ProgressMonitorDemo
    ... > ActualTask and also tried lowering the worker thread's priority to ... >>> Why does it take so long for the ProgressMonitor to display in this ...
    (comp.lang.java.gui)
  • ProgressMonitor takes too long to display in Suns ProgressMonitorDemo
    ... When I ran this modified project, the ProgressMonitor took 10 seconds ... through one iteration before the ProgressMonitor will display. ... not very useful if the first iteration takes a long time. ...
    (comp.lang.java.gui)
  • graphics with Distributed Computing Toolbox
    ... I new to do some display with a worker using Distributed ... Because workers don't have graphics, ... I need the client to process ...
    (comp.soft-sys.matlab)
  • Re: A complicated case with continous form
    ... I have to display the working hours of workers in a form,so I use continuous ... my method is I use 2 text box for 100% and 150%, if that worker dont have any ... 150% hours,i will hide that textbox, so it take me 2 lines to keep 2 textbox ... This would be a lot easier to do with a report, not a form, because a report can use grouping and the Hide Duplicates property to handle this easily. ...
    (microsoft.public.access.forms)
  • Can a views Invalidate be called safely from an external thread?
    ... I want a view to display some data collected/processed by a couple of worker ... Is it safe to call the views Invalidate from these threads, ...
    (microsoft.public.vc.language)