@Override public String getLastFailure() { if(mDataEmitter != null && mDataEmitter.getLastFailure() != null) { return mDataEmitter.getLastFailure().toString(); } return null; }
/** * Closes the connection to the remote source of data. * This instance is unusable after this method is invoked. * <p> * If one needs to reconnect to the remote source, a new instance * of this class should be created. * <p> * This method does not fail if the attempt to close the connection fails. * In case of failures, the failures are logged and the method returns * silently. */ public synchronized void close() { if(mContext == null) { return; } boolean isConnected = getLastFailure() == null; try { mContext.close(); } catch (Exception e) { //Swallow the exception as it prevents the module from stopping. //If the receiver closed the connection from its end //this method always fails. Messages.LOG_ERROR_CLOSING_CONNECTION.warn(this, e); } mContext = null; if(isConnected) { sendConnectedChanged(isConnected, false); } }