close();
close(repository);
    public void open(SVNRepositoryImpl repository) throws SVNException {        ISVNAuthenticationManager authManager = repository.getAuthenticationManager();        String realm = repository.getLocation().getProtocol() + "://" + repository.getLocation().getHost();        if (repository.getLocation().hasPort()) {            realm += ":" + repository.getLocation().getPort();        }                int reconnect = 1;        while(true) {            SVNSSHAuthentication authentication = (SVNSSHAuthentication) authManager.getFirstAuthentication(ISVNAuthenticationManager.SSH, realm, repository.getLocation());            Connection connection = null;                        while (authentication != null) {                try {                    connection = SVNGanymedSession.getConnection(repository.getLocation(), authentication);                    if (connection == null) {                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Cannot connect to ''{0}''", repository.getLocation().setPath("", false));                        SVNErrorManager.error(err);                    }                    authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.SSH, realm, null, authentication);                    break;                } catch (SVNAuthenticationException e) {                    authManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.SSH, realm, e.getErrorMessage(), authentication);                    authentication = (SVNSSHAuthentication) authManager.getNextAuthentication(ISVNAuthenticationManager.SSH, realm, repository.getLocation());                    connection = null;                }            }            if (authentication == null) {                SVNErrorManager.cancel("authentication cancelled");            } else if (connection == null) {                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Can not establish connection with to ''{0}''", realm));            }            try {                mySession = connection.openSession();                SVNAuthentication author = authManager.getFirstAuthentication(ISVNAuthenticationManager.USERNAME, realm, repository.getLocation());                if (author == null) {                    SVNErrorManager.cancel("authentication cancelled");                }                authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.USERNAME, realm, null, author);                if (author.getUserName() == null || author.getUserName().equals(authentication.getUserName()) ||                         "".equals(author.getUserName())) {                    repository.setExternalUserName("");                } else {                    repository.setExternalUserName(author.getUserName());                 }                if ("".equals(repository.getExternalUserName())) {                    mySession.execCommand(SVNSERVE_COMMAND);                } else {                    mySession.execCommand(SVNSERVE_COMMAND_WITH_USER_NAME + repository.getExternalUserName());                }                    myOutputStream = mySession.getStdin();                myInputStream = mySession.getStdout();                new StreamGobbler(mySession.getStderr());                if (!SVNGanymedSession.isUsePersistentConnection()) {                    myConnection = connection;                }                 return;            } catch (IOException e) {                reconnect--;                if (reconnect >= 0) {                    // try again, but close session first.                    SVNGanymedSession.closeConnection(connection);                    connection = null;                    continue;                }                SVNDebugLog.logInfo(e);                close();                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Cannot connect to ''{0}'': {1}", new Object[] {repository.getLocation().setPath("", false), e.getLocalizedMessage()});                SVNErrorManager.error(err, e);            }        }    }