Why assertServiceContextNotDestroyed() is needed in ServiceContextImpl.removeListener(ServiceContextListener listner)?
This is regarding the Issue Tracker OCAP_RI-450.
As per the fix mentioned in the IT-OCAP_RI-450, the ProgramMonitor.updateServiceContext(ServiceContextExt sc) has to call m_serviceContext.removeListener(this) to remove previously added listener when the sc is null. But this call won't remove the previously added Listener as the IllegalStateException is thrown from the AssertServiceContextNotDestroyed. This is because the currentState (of ServiceContextImpl.java) is updated with the STATE_DESTROYED when the service context is destroyed(sc == null).
What are the advantages of having assertServiceContextNotDestroyed in ServiceContextImpl.removeListener(ServiceContextListener listener)? Does it protect the RI from any weird behavior?