Threading question

View: New views
5 Messages — Rating Filter:   Alert me  

Threading question

by ljnelson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I read http://core.netbeans.org/proposals/threading/index.html and it scared me because it sounds like threading in NetBeans is all over the map.

What is the recommended way to perform a network task?  When someone double-clicks on one of my custom Nodes, I'd like to put up a wait cursor, move the processing to another thread, wait for the task to complete and reset the cursor (and get back on the EDT).  Normally I'd use a SwingWorker for this, but I am curious if there is some NetBeans class (like RequestProcessor?) that I should be using instead.

Thanks,
Laird

RES: Threading question

by Eduardo Maurício da Costa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Laird,

In NetBeans applications, you don't "lock" the whole interface. The correct
way is using RequestProcessor to organize and run tasks in background, and,
if you want to give users a feedback, use ProgressHandle.

Regards,
Eduardo

-----Mensagem original-----
De: ljnelson [mailto:ljnelson@...]
Enviada em: domingo, 13 de julho de 2008 14:51
Para: dev@...
Assunto: [openide-dev] Threading question


I read http://core.netbeans.org/proposals/threading/index.html and it scared
me because it sounds like threading in NetBeans is all over the map.

What is the recommended way to perform a network task?  When someone
double-clicks on one of my custom Nodes, I'd like to put up a wait cursor,
move the processing to another thread, wait for the task to complete and
reset the cursor (and get back on the EDT).  Normally I'd use a SwingWorker
for this, but I am curious if there is some NetBeans class (like
RequestProcessor?) that I should be using instead.

Thanks,
Laird
--
View this message in context:
http://www.nabble.com/Threading-question-tp18431804p18431804.html
Sent from the Netbeans - Open API mailing list archive at Nabble.com.



--
Esta mensagem foi verificada pelo sistema de antivírus e
 acredita-se estar livre de perigo.


Re: RES: Threading question

by ljnelson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eduardo Maurício da Costa wrote:
In NetBeans applications, you don't "lock" the whole interface. The correct
way is using RequestProcessor to organize and run tasks in background, and,
if you want to give users a feedback, use ProgressHandle.
Thank you so much; exactly what I was looking for.

Best,
Laird

Re: RES: Threading question

by ljnelson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eduardo Maurício da Costa wrote:
In NetBeans applications, you don't "lock" the whole interface. The correct
way is using RequestProcessor to organize and run tasks in background, and,
if you want to give users a feedback, use ProgressHandle.
One last question, since the javadoc doesn't say anything about it: must ProgressHandle be invoked on the EDT?  Or does it matter?

I have a task that can take some time if the network is sluggish, and can be instantaneous in other cases.  Sometimes I see the ProgressHandle, and sometimes I don't.  I have invoked it from both the EDT exclusively, and from a non-EDT thread exclusively.  I was wondering if I should always be invoking it from a particular thread, or if it matters.

Thank you again for your quick response.

Best,
Laird

Re: RE[openide-dev] S: Threading question

by Jesse Glick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ljnelson wrote:
> must ProgressHandle be invoked on the EDT? Or does it matter?

I don't think it matters.