Overlapping SQL statements in PresenceManagerImpl

Attached is a patch to PresenceManagerImpl.java which changes it to use a transaction for the delete and insert statements in the userUnavailable method. Without this Openfire’s ofPresence table can get out of synch and you may get a SQLException about duplicate entries. We’ve only seen this when a user was going online and offline very quickly but wanted to share the fix in case its affecting others. There was a bug related to this, but I haven’t been able to find it again. The bug listed that a similar problem was occurring in the roster manager. I checked though and it appears to correctly be using transactions to ensure deletes and inserts occur in sequence.

Brian