Issue #2903 added connection tests to session close methods

fixes illegal state exception problem when booted from xmpp server


Former-commit-id: 49f86e4153 [formerly 50f3f420eb [formerly d570c81caed35576e867df15c2a8d900135fef5f]]
Former-commit-id: 50f3f420eb
Former-commit-id: f9ab4f9cfe
This commit is contained in:
Brian Clements 2014-04-22 12:34:30 -05:00
parent 17945fcbef
commit 053136ccbb
2 changed files with 22 additions and 14 deletions

View file

@ -98,6 +98,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Mar 31, 2014 2899 mpduff Improve error messages. * Mar 31, 2014 2899 mpduff Improve error messages.
* Apr 15, 2014 2822 bclement added check for other participants being subscribed to topic * Apr 15, 2014 2822 bclement added check for other participants being subscribed to topic
* Apr 21, 2014 2822 bclement removed use of resources in topicSubscribers, added skipCache * Apr 21, 2014 2822 bclement removed use of resources in topicSubscribers, added skipCache
* Apr 22, 2014 2903 bclement added connection test to closePubSub() method
* *
* </pre> * </pre>
* *
@ -511,21 +512,24 @@ public class SharedDisplaySession extends VenueSession implements
closePubSub(); closePubSub();
} }
/**
* clean up pub sub subscription and objects
*/
private void closePubSub() { private void closePubSub() {
try { try {
if (pubsubMgr == null || topic == null || !topicExists()) { if (conn != null && conn.isConnected() && pubsubMgr != null
return; && topic != null && topicExists()) {
} Subscription sub = findSubscription(getAccount());
Subscription sub = findSubscription(getAccount()); if (sub == null) {
if (sub == null) { return;
return; }
} topic.unsubscribe(sub.getJid(), sub.getId());
topic.unsubscribe(sub.getJid(), sub.getId()); topic.removeItemDeleteListener(this);
topic.removeItemDeleteListener(this); topic.removeItemEventListener(this);
topic.removeItemEventListener(this); if (hasRole(SharedDisplayRole.SESSION_LEADER)) {
if (hasRole(SharedDisplayRole.SESSION_LEADER)) { cleanUpHttpStorage(topic.getId());
cleanUpHttpStorage(topic.getId()); pubsubMgr.deleteNode(topic.getId());
pubsubMgr.deleteNode(topic.getId()); }
} }
topic = null; topic = null;
pubsubMgr = null; pubsubMgr = null;

View file

@ -109,6 +109,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Apr 11, 2014 2903 bclement made constructor public b/c connection code moved packages * Apr 11, 2014 2903 bclement made constructor public b/c connection code moved packages
* Apr 16, 2014 3020 bclement added check for invited rooms in roomExistsOnServer() * Apr 16, 2014 3020 bclement added check for invited rooms in roomExistsOnServer()
* Apr 21, 2014 2822 bclement added hasMultipleHandles() * Apr 21, 2014 2822 bclement added hasMultipleHandles()
* Apr 22, 2014 2903 bclement added connection test to close method
* *
* *
* </pre> * </pre>
@ -192,7 +193,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
muc.removeParticipantListener(participantListener); muc.removeParticipantListener(participantListener);
participantListener = null; participantListener = null;
} }
muc.leave(); CollaborationConnection conn = getConnection();
if (conn != null && conn.isConnected()) {
muc.leave();
}
muc = null; muc = null;
} }