Why does it take 2 minutes to login to RTC using a plainJava login API?
I have written some plainJava utilities for updating work items etc and have used the code examples available in this forum but I find that when i run the utility for the first time it takes > 2 mins to perform the initial login.
The relevant code is:
public class RTCclient {
private static Logger logger = null;
private ITeamRepository teamRepository = null;
private String repositoryURI = null;
private String userId = null;
private String password = null;
private static IWorkspaceManager wm;
private static IWorkspace workspace;
private static IWorkspaceConnection workspaceConnection;
private static IFileSystemWorkItemManager fileWorkItemmanager;
private static IWorkspaceConnection streamConnection;
private static List<IComponent> iComponents;
private static IFileContentManager contentManager;
private static IComponent myComponent;
private static String myStreamName = "unknown";
/**
*
*
*/
private static class LoginHandler implements ILoginHandler, ILoginInfo {
private String fUserId;
private String fPassword;
/**
* @param userId
* @param password
*/
private LoginHandler(String userId, String password) {
fUserId = userId;
fPassword = password;
}
public String getUserId() {
return fUserId;
}
public String getPassword() {
return fPassword;
}
public ILoginInfo challenge(ITeamRepository repository) {
return this;
}
}
/**
* @param repositoryURI
* @param rtcUserid
* @param rtcPassword
*/
public RTCclient( String repositoryURI,
String rtcUserid,
String rtcPassword
//String projectAreaName
) {
this.repositoryURI = repositoryURI;
this.userId = rtcUserid;
this.password = rtcPassword;
}
public ITeamRepository login() {
this.teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
this.teamRepository.registerLoginHandler(new LoginHandler(userId, password));
try {
this.teamRepository.login(null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
System.exit(1);
}
return this.teamRepository;
}
and my Java utility simply performs a:
rtcClient = new RTCclient("https://myjazzserver.com:9443/jazz", "me@acme.com", "mypassword");
teamRepository = rtcClient.login();
The login() call takes 120 secs or more the first time I run the utility. If I then run the utility a little latter the login() takes 1 sec or so.
I also get the following console messages, for both slow and fast logins:
17-May-2013 12:57:58 org.apache.commons.httpclient.HttpMethodDirector isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled
Since I'm presumably using code that many others have used successfully, is there some setting on the server that might be incorrect? Does anyone have any idea what might be causing the login delay?
The relevant code is:
public class RTCclient {
private static Logger logger = null;
private ITeamRepository teamRepository = null;
private String repositoryURI = null;
private String userId = null;
private String password = null;
private static IWorkspaceManager wm;
private static IWorkspace workspace;
private static IWorkspaceConnection workspaceConnection;
private static IFileSystemWorkItemManager fileWorkItemmanager;
private static IWorkspaceConnection streamConnection;
private static List<IComponent> iComponents;
private static IFileContentManager contentManager;
private static IComponent myComponent;
private static String myStreamName = "unknown";
/**
*
*
*/
private static class LoginHandler implements ILoginHandler, ILoginInfo {
private String fUserId;
private String fPassword;
/**
* @param userId
* @param password
*/
private LoginHandler(String userId, String password) {
fUserId = userId;
fPassword = password;
}
public String getUserId() {
return fUserId;
}
public String getPassword() {
return fPassword;
}
public ILoginInfo challenge(ITeamRepository repository) {
return this;
}
}
/**
* @param repositoryURI
* @param rtcUserid
* @param rtcPassword
*/
public RTCclient( String repositoryURI,
String rtcUserid,
String rtcPassword
//String projectAreaName
) {
this.repositoryURI = repositoryURI;
this.userId = rtcUserid;
this.password = rtcPassword;
}
public ITeamRepository login() {
this.teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
this.teamRepository.registerLoginHandler(new LoginHandler(userId, password));
try {
this.teamRepository.login(null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
System.exit(1);
}
return this.teamRepository;
}
and my Java utility simply performs a:
rtcClient = new RTCclient("https://myjazzserver.com:9443/jazz", "me@acme.com", "mypassword");
teamRepository = rtcClient.login();
The login() call takes 120 secs or more the first time I run the utility. If I then run the utility a little latter the login() takes 1 sec or so.
I also get the following console messages, for both slow and fast logins:
17-May-2013 12:57:58 org.apache.commons.httpclient.HttpMethodDirector isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled
Since I'm presumably using code that many others have used successfully, is there some setting on the server that might be incorrect? Does anyone have any idea what might be causing the login delay?
2 answers
Hi Dave, you can find the code I am usually using here and in several posts on the site. It takes some time to initialize the TeamPlatform and to log into the system. However, I have never seen it taking 2 minutes. For me it is rather in the area of 30 seconds. It appears to be the same time every time I start a client. I am not sure why it takes only 1 sec the next time around. It is only quicker, if the java code is not finished. In that case the TeamPlatform is still loaded and has all the data cached that is required.