Make Smack interruptible

Description

For example Smack sendX() and PacketCollector.pollX() should throw InterruptedException.

If a thread which is currently blocking in Smack's send queue put() is interrupted then Smack 4.1 currently swallows the exception. Instead it should be thrown to that users are able to interrupt threads that are waiting in put(). Same goes for packet collector's blocking method calls and also SynchronizationPoint and Roster.waitUntilLoaded(). Basically in most places where Smack currently swallows an InterruptedException ('ag InterruptedException smack') those should be thrown instead of swallowed.

Scheduling for 4.2 since this is a rather big API change.

Open Question: Should Smack throw InterruptedException directly or should we wrap InterruptedException into a SmackInterruptedException? Some APIs already throw SmackException (e.g. MultiUserChat.create()), some not e.g. Roster.createEntry()). I guess the right way would be to throw InterruptedException directly, although it does bloat the API a bit. But OTOH the additional exception can be handled by the user very well with try/multi-catch.

See TODO comment in XMPPTCPConnection.sendStreamElement()

Motivation was mostly http://www.ibm.com/developerworks/library/j-jtp05236/

Environment

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Labels

Expected Effort

Medium

Components

Fix versions

Affects versions

Priority

Created January 16, 2015 at 2:50 PM
Updated April 6, 2015 at 10:22 AM
Resolved April 6, 2015 at 10:22 AM