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);
		}
	}
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException {
		try {
		
			if (_advancedLifecycleManagementEnabled) {
				_sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED;
				firstTimeFull = true;
			
				Boolean waitForInterfaceUnregistered = false;
			
				synchronized(CONNECTION_REFERENCE_LOCK) {
					if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) {
						waitForInterfaceUnregistered = true;
						unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
					}
				}
			
				if (waitForInterfaceUnregistered) {
					synchronized(APP_INTERFACE_REGISTERED_LOCK) {
						try {
							APP_INTERFACE_REGISTERED_LOCK.wait(3000);
						} catch (InterruptedException e) {
						
						}
					}
				}
			}
			if(rpcResponseListeners != null){
				rpcResponseListeners.clear();
			}
			if(rpcNotificationListeners != null){
				rpcNotificationListeners.clear();
			}
		
			synchronized(CONNECTION_REFERENCE_LOCK) {
				if (sdlSession != null) sdlSession.close();
			}		
		} catch (SdlException e) {
			throw e;
		} finally {
			SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY);
		}
	}
private void cleanproxy(sdldisconnectedreason disconnectedreason) throws sdlexception { try { if (_advancedlifecyclemanagementenabled) { _sdlconnectionstate = sdlconnectionstate.sdl_disconnected; firsttimefull = true; boolean waitforinterfaceunregistered = false; synchronized(connection_reference_lock) { if (sdlsession != null && sdlsession.getisconnected() && getappinterfaceregistered()) { waitforinterfaceunregistered = true; unregisterappinterfaceprivate(unregister_app_interface_correlation_id); } } if (waitforinterfaceunregistered) { synchronized(app_interface_registered_lock) { try { app_interface_registered_lock.wait(3000); } catch (interruptedexception e) { } } } } if(rpcresponselisteners != null){ rpcresponselisteners.clear(); } if(rpcnotificationlisteners != null){ rpcnotificationlisteners.clear(); } synchronized(connection_reference_lock) { if (sdlsession != null) sdlsession.close(); } } catch (sdlexception e) { throw e; } finally { sdltrace.logproxyevent("sdlproxy cleaned.", sdl_lib_trace_key); } }