powered by Jive Software

Does OfflineMessageStore.getSize(username) return Cached information?

I’‘m (still) writing a plugin that notifies people of offline messages over another, non-XMPP medium. I’‘m trying to send notifications on each first offline message that is received. After that, notifications won’'t be send again until the user clears its offline message store.

To do this, I’‘m using the OfflineMessageStore.getSize(username) method. In pseudo, I’'m trying to somthing like this (where ‘‘oms’’ is an OfflineMessageStore instance):

int spaceUsed = oms.getSize(receipientUserName);

if ( spaceUsed == 0 )


// user has no messages in store yet





// user has had a previous notification,

// don’'t send one again.

Log.info("Sorry, couldn’'t send notification. "

  • "The receipient already has "

  • spaceUsed + " bytes of "

  • “messages waiting for him/her.”);



Sadly, this doesn’‘t seem to work. After a user reads his offline messages, OfflineMessageStore.getSize(username) seems to return data for offline messages that do not exist anymore. I checked the ‘‘jiveOffline’’ table: it’'s empty, but still getSize() returns non-zero values. Is this some intended caching/buffering or a bug? Can someone think of a workaround?


You are correct, the cache is not being updated correctly. Heres a version that actually updates the sizeCache if you call any of


OfflineMessageStore.deleteMessage(username, datecreated)

OfflineMessageStore.getMessages(username, true)

Maybe matt or gato can review and check in to svn if appropriate.

Hope that helps,

OfflineMessageStore.java (15680 Bytes)

Thanks guys for reporting the problem and providing a fix. The patch has been incorporated and the related jira issue is JM-423.


– Gato

Ah, great. Thanks guys!