[rabbitmq-discuss] IOExceptions and the java client api
Henric.Larsson at igindex.co.uk
Fri Nov 7 12:03:11 GMT 2008
In the javadoc almost every method is documented as throwing the checked
IOException "if an error is encountered", but there's no mention of the
unchecked exceptions that may be thrown.
My understanding after using the client for a while is that the
IOException isn't likely to be thrown. In the case of a server
disconnect the actual exception thrown would be the unchecked
com.rabbitmq.client.ShutdownSignalException or a derived exception.
Making any code that relies on catching IOException for failure handling
/ reconnect logic broken.
I think the javadoc should mention all exceptions that may be thrown and
when they would be expected.
Furthermore, I personally think that the IOException is almost as course
grained as declaring that all methods throws Exception - not only does
this make for unnecessary cluttered code when using the client, all
invocations must be wrapped in a try/catch block, but it doesn't give
any real information about the underlying problem; Server shutdown, pipe
broken, dodgy data on the wire..
My suggestion is to have a hierarchy of unchecked exceptions with real
meaning clearly documented in the api - giving users the option of
catching the exceptions that can be recovered from while allowing other
exceptions to be propagated to the caller.
The information contained in this email is strictly confidential and for the use of
the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or
disclose to others this message or any attachment. Please also notify the sender by replying to this email or by
telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do
not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index
plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered
Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services
Authority. FSA Register number 114059.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss