It's all about the answers!

Ask a question

RTC login connection time out problem


Sudipto Sarkar (63742) | asked Jul 04 '16, 2:31 a.m.
edited Jul 04 '16, 3:18 a.m. by Ralph Schoon (62.0k33643)
Hi All,

I am trying to log in to RTC through java API.

I want to release the connection when it takes too long. I basically use the following code:

public ITeamRepository login(String serverPath) throws TeamRepositoryException {
        ITeamRepository repository = TeamPlatform.getTeamRepositoryService()
                .getTeamRepository(serverPath);
      
        repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
            public ILoginInfo challenge(ITeamRepository repository) {
                return new ILoginInfo() {
                    public String getUserId() {
                        return myUsername;
                    }

                    public String getPassword() {
                        return myPwd;
                    }
                };
            }
        });
       
        repository.login(monitor);
    
        return repository;
    }


The repository timeout time is 480 seconds, it releases the connection after that. I want to cancel this operation say after 30 seconds. I tried to set the timeout for repository (repository.setConnectionTimeout(number)). But it did not work.

In the background it keeps logging for 480 seconds:
2016-06-07 14:26:32 INFO  HttpMethodDirector:439 - I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
2016-06-07 14:26:32 INFO  HttpMethodDirector:445 - Retrying request



How do I solve this..? Any hints?

Be the first one to answer this question!


Register or to post your answer.