From: Dolazy Date: 2008-10-21T06:13:49+09:00 Subject: Re: Threading best practices? On 20 okt, 22:29, Robert Klemme wrote: > On 20.10.2008 21:42, Dolazy wrote: > > > I am developing a small GUI application using jruby. It will be used > > for testing API calls to my company's server. I would like my > > application to execute server calls in a non-blocking way. > > What does the rest of the application do in the meantime? Anything that the user is doing at that time. I want to avoid freezing the GUI. > Not sure what exactly you mean by "InvokeLater".  Do you want to pass > the result of method calls back to the calling thread? Yes, that's exactly what I have in mind. > Another option is to set up a Queue for feedback which is queried from > the main thread.  It all depends on what you application does or what > you want to achieve.  Can you give more detail? For example, one of the first calls will be the login method. In a worker thread I want to send the login message, receive the response, and then notify the main thread of either a successful or failed login, by means of invoking the corresponding callback.