It's all about the answers!

Ask a question

How can we programmatically confirm a connection to RTC is available?

RachitKumar Chirania (1111) | asked Jul 23 '13, 6:25 a.m.
edited Jul 24 '13, 3:44 p.m. by Millard Ellingsworth (2.5k12431)

I logged in to RTC repository and sucessfully connnected ot RTC.I got my teamRepositoryObject as well.Even connection to RTC repository not available, the teamRepository method "isLoggedIn" is giving value as "true" through Jazz RTC API's.

Could any one suggest that how will check the whether connection to RTC is available or not periodically?

Tim Mok commented Jul 24 '13, 4:39 p.m.

What kind of error do you get when you try to use the repository connection? If your logged in check passes, the connection should be good. Maybe you can try adding a listener to the repository connection to see if the connection drops at any point you try to use it.

Also, a code sample may also help determine if something in between your check and use is causing some kind of instability with the connection.

RachitKumar Chirania commented Jul 25 '13, 7:59 a.m.

See Initially I have connected successfully  to RTC Repository.My code is working fine.But suppose connection drops at any point during my code flow, how come i will know whether connection exists or not.

For that I have created one method name "checkRTCConnection" In which I am sending a simple request to server and if exception occurs it means Connection does not exist.

Below is the code :
public boolean checkRTCConnection() {boolean isRTCConnectionExist = true;
try{long attachmentSize = getWorkItemClient().fetchMaxAttachmentSize(null);}catch(Exception e){isRTCConnectionExist = false;}

RachitKumar Chirania commented Jul 25 '13, 8:00 a.m.

is there any alternate way to do this ??

One answer

permanent link
Ralph Schoon (62.9k33645) | answered Jul 25 '13, 8:06 a.m.
I use the code from in the Plain Java API section for years now and I have never seen any issue. Please provide your code so that we can understand what the issue is. You might also want to look into

Ralph Schoon commented Jul 25 '13, 8:10 a.m.

Opposite to what you describe my connection does never drop.I think you might want to look at network level. Maybe your infrastructure drops the connection if they are idle for some reason. If you experience what you say with Plain Java, you should intermittently loose connection with the Eclipse client too. You would have to  log out and log back in, because the client does not expect to loose the connection.

Your answer

Register or to post your answer.