Java D-Bus API: Handling errors with callWithCallback()

Schmottlach, Glenn glenn.schmottlach at
Mon Nov 30 06:14:56 PST 2009

I am (attempting) to write a Java D-Bus client that uses AbstractConnection.callWithCallback() to asynchronously issue requests to a D-Bus service. This reason I am using this method versus AbstractConnection.callMethodAsync() is that I want to be notified (via the callback) when the reply is returned rather than wait (or poll) for the response. I have successfully used this method to make requests to services and received a response via the callback (e.g. it works as advertised). What I want to understand is how to handle D-Bus error messages returned instead of a response to a request. If I was issuing a blocking call through the remote object's interface I could put a try/catch block around the request and "catch" the error message. With callWithCallback() method there does not appear to be a mechanism to report back any errors. Likewise, there does not appear to be a mechanism to either cancel the request or specify a timeout on the request. So, to summarize, these are my questions:

1) How do I detect errors using callWithCallback()?
2) Can I specify a timeout to wait for a response with callWithCallback()?
3) Can I cancel a request issued with callWithCallback()?

Thanks . . .

[cid:image001.jpg at 01CA719D.956886A0]

39001 West 12 Mile Road
Farmington Hills, MI 48331, U.S.A.
Phone: +1 248 592 3217
Mobile: +1 248 885 5864
Fax: +1 248 994 2703
Email: Glenn.Schmottlach at<mailto:Glenn.Schmottlach at>

Electronic System Integration
Harman/Becker Automotive Systems

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1863 bytes
Desc: image001.jpg
Url : 

More information about the dbus mailing list