in core/src/main/java/flex/messaging/MessageClient.java [591:632]
public void resetEndpoint(String newEndpointId) {
String oldEndpointId = null;
FlexSession oldSession = null;
FlexSession newSession = FlexContext.getFlexSession();
synchronized (lock) {
// If anything is null, or nothing has changed, no need for a reset.
if (endpointId == null || newEndpointId == null || flexSession == null || newSession == null || (endpointId.equals(newEndpointId) && flexSession.equals(newSession)))
return;
oldEndpointId = endpointId;
endpointId = newEndpointId;
oldSession = flexSession;
flexSession = newSession;
}
// Unregister in order to reset the proper push settings in the re-registration below once the session association has been patched.
if (flexClient != null)
flexClient.unregisterMessageClient(this);
// Clear out any reference to this subscription that the previously associated session has.
if (oldSession != null)
oldSession.unregisterMessageClient(this);
// Associate the current session with this subscription.
if (flexSession != null)
flexSession.registerMessageClient(this);
// Reset proper push settings.
if (flexClient != null)
flexClient.registerMessageClient(this);
if (Log.isDebug()) {
String msg = "MessageClient with clientId '" + clientId + "' for destination '" + destinationId + "' has been reset as a result of a resubscribe.";
if (oldEndpointId != null && !oldEndpointId.equals(newEndpointId))
msg += " Endpoint change [" + oldEndpointId + " -> " + newEndpointId + "]";
if ((oldSession != null) && (newSession != null) && (oldSession != newSession)) // Test identity.
msg += " FlexSession change [" + oldSession.getClass().getName() + ":" + oldSession.getId() + " -> " + newSession.getClass().getName() + ":" + newSession.getId() + "]";
Log.getLogger(MESSAGE_CLIENT_LOG_CATEGORY).debug(msg);
}
}