Showing results for 
Search instead for 
Did you mean: 

Is there a bug with Terminal.removeObserver() ?

This document was generated from CDN thread

Created by: UUser SNUUser on 08-04-2010 01:58:02 AM
I'm getting a null pointer error when I'm removing a terminal observer.  Here's the relevant part of the stacktrace


I'm calling terminal.removeObserver from within my provider listener during the ProvOutOfService and ProvShutdown events.  Could I be getting the exception if the observer isn't already attached?  According to the jtapi spec, if an observer isn't attached the removeObserver and removeCallObserver functions are supposed to fail silently which is why I was wondering if there's a bug in the implementation.
Can I just ignore the error?  It doesn't seem to have any negative effect

Subject: RE: Is there a bug with Terminal.removeObserver() ?
Replied by: Abhishek Malhotra on 08-04-2010 05:31:06 AM
What is the JTAPI version that you are using?
Also, do you run EM scenarios on your setup? Just in case if the you are using EM scenarios and try to remove the observer on the Address which is no longer there on Terminal then app is essentially holding on to a stale address object that application is still holding on to and doesnt exist in JTAPI anymore and may cause unforeseen results. Application is suppose to clear the references of all the address objects on getting CiscoAddrRemovedEv. There was some fix in JTAPI recently to eat up this exception but ideally this is application issue.
If this is not related to EM then please share the JTAPI logs and the JTAPI version for this and we can take a look.

Subject: RE: Is there a bug with Terminal.removeObserver() ?
Replied by: Abhishek Malhotra on 08-04-2010 05:35:21 AM
My bad... I read it as Address.removeObserver but I see that you are actually removing observer from the terminal. What i say would still hold good if application sends a request on stale Terminal object. Basically, if application sends a request on terminal for which JTAPI has already sent CiscoTerminalRemovedEv.
Please share the logs from the application start time to the point this issue is seen for us to investigate this.

Subject: RE: Is there a bug with Terminal.removeObserver() ?
Replied by: David Staudt on 08-04-2010 02:54:14 PM
Indeed, and this can be a race condition, where JTAPI removes the observer automatically due to some process, at the same time the app attempts to remove it: one action or the other may happen first, and each needs to be gracefully prepared for the request to fail.  Unless the observer removal is very unexpected or is causing an issue, I think your idea that there is no need to worry is justified.
If the issue is unexpected and causing a big problem, then we can go down the route of looking at detailed logs, etc.

I run into the same problem. This issue is difficult to create trouble but it may. In my case I had a try catch who was holding observedAddress.removeCallObserver, observedAddress.removeObserver, observedTerminal.removeObserver and in that case one thread HeartBeat was kept alive causing the CTI Manager to increase by one (seen with the real time monitoring tool).

What we did was to write a single separate  try catch for every line, so subsequent lines will execute nevertheless the previous ones (because of this race) will launch a null pointer.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.