Issue #2903 added connection tests to session close methods

fixes illegal state exception problem when booted from xmpp server


Former-commit-id: f9ab4f9cfe [formerly 50f3f420eb] [formerly f9ab4f9cfe [formerly 50f3f420eb] [formerly 49f86e4153 [formerly d570c81caed35576e867df15c2a8d900135fef5f]]]
Former-commit-id: 49f86e4153
Former-commit-id: 9ef018dbe8 [formerly c9453a2440]
Former-commit-id: 9ea5430774
This commit is contained in:
Brian Clements 2014-04-22 12:34:30 -05:00
parent f93a81d2f6
commit d2b2106f4c
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.
* 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 22, 2014 2903 bclement added connection test to closePubSub() method
*
* </pre>
*
@ -511,21 +512,24 @@ public class SharedDisplaySession extends VenueSession implements
closePubSub();
}
/**
* clean up pub sub subscription and objects
*/
private void closePubSub() {
try {
if (pubsubMgr == null || topic == null || !topicExists()) {
return;
}
Subscription sub = findSubscription(getAccount());
if (sub == null) {
return;
}
topic.unsubscribe(sub.getJid(), sub.getId());
topic.removeItemDeleteListener(this);
topic.removeItemEventListener(this);
if (hasRole(SharedDisplayRole.SESSION_LEADER)) {
cleanUpHttpStorage(topic.getId());
pubsubMgr.deleteNode(topic.getId());
if (conn != null && conn.isConnected() && pubsubMgr != null
&& topic != null && topicExists()) {
Subscription sub = findSubscription(getAccount());
if (sub == null) {
return;
}
topic.unsubscribe(sub.getJid(), sub.getId());
topic.removeItemDeleteListener(this);
topic.removeItemEventListener(this);
if (hasRole(SharedDisplayRole.SESSION_LEADER)) {
cleanUpHttpStorage(topic.getId());
pubsubMgr.deleteNode(topic.getId());
}
}
topic = 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 16, 2014 3020 bclement added check for invited rooms in roomExistsOnServer()
* Apr 21, 2014 2822 bclement added hasMultipleHandles()
* Apr 22, 2014 2903 bclement added connection test to close method
*
*
* </pre>
@ -192,7 +193,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
muc.removeParticipantListener(participantListener);
participantListener = null;
}
muc.leave();
CollaborationConnection conn = getConnection();
if (conn != null && conn.isConnected()) {
muc.leave();
}
muc = null;
}