// Wait for the app interface to be unregistered
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException {
		try {
			// ALM Specific Cleanup
			if (_advancedLifecycleManagementEnabled) {
				_sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED;
				firstTimeFull = true;
				// Should we wait for the interface to be unregistered?
				Boolean waitForInterfaceUnregistered = false;
				// Unregister app interface
				synchronized(CONNECTION_REFERENCE_LOCK) {
					if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) {
						waitForInterfaceUnregistered = true;
						unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
					}
				}
				// Wait for the app interface to be unregistered
				if (waitForInterfaceUnregistered) {
					synchronized(APP_INTERFACE_REGISTERED_LOCK) {
						try {
							APP_INTERFACE_REGISTERED_LOCK.wait(3000);
						} catch (InterruptedException e) {
							// Do nothing
						}
					}
				}
			}
			if(rpcResponseListeners != null){
				rpcResponseListeners.clear();
			}
			if(rpcNotificationListeners != null){
				rpcNotificationListeners.clear(); //TODO make sure we want to clear this
			}
			// Clean up SDL Connection
			synchronized(CONNECTION_REFERENCE_LOCK) {
				if (sdlSession != null) sdlSession.close();
			}		
		} catch (SdlException e) {
			throw e;
		} finally {
			SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY);
		}
	}
}
}
// Wait for the app interface to be unregistered
if (waitForInterfaceUnregistered) {
synchronized(APP_INTERFACE_REGISTERED_LOCK) {
firstTimeFull = true;
// Should we wait for the interface to be unregistered?
Boolean waitForInterfaceUnregistered = false;
// Unregister app interface
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) {
waitForInterfaceUnregistered = true;
unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
}
}
// Wait for the app interface to be unregistered
if (waitForInterfaceUnregistered) {
synchronized(APP_INTERFACE_REGISTERED_LOCK) {
try {
APP_INTERFACE_REGISTERED_LOCK.wait(3000);
} catch (InterruptedException e) {
// Do nothing
}
}
}
}
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException {
try {
// ALM Specific Cleanup
if (_advancedLifecycleManagementEnabled) {
_sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED;
firstTimeFull = true;
// Should we wait for the interface to be unregistered?
Boolean waitForInterfaceUnregistered = false;
// Unregister app interface
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) {
waitForInterfaceUnregistered = true;
unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
}
}
// Wait for the app interface to be unregistered
if (waitForInterfaceUnregistered) {
synchronized(APP_INTERFACE_REGISTERED_LOCK) {
try {
APP_INTERFACE_REGISTERED_LOCK.wait(3000);
} catch (InterruptedException e) {
// Do nothing
}
}
}
}
if(rpcResponseListeners != null){
rpcResponseListeners.clear();
}
if(rpcNotificationListeners != null){
rpcNotificationListeners.clear(); //TODO make sure we want to clear this
}
// Clean up SDL Connection
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null) sdlSession.close();
}