Release network resources when the channels are no longer used
Network channels are connected when a Cavity object is created. They stay connected even when cavity is removed from the table or the whole document is closed. Imagine having two documents opened with the first one having 3 rows and the other one having 50 rows. Then the second document is closed. We need to update only first document with data coming from 3 cavities, but we are actually getting (and throwing away) updates from the 50 cavities of the second closed document. This is ineffective!
- Checkout branch disconnect and merge it into your local repository. It contains necessary modifications that will allow to stop UpdatingPV.
- Explore changes. UpdatingPV has method disconnect().
- Every time a cavity is removed from table, it should disconnect all its PVs. Create a method disconnect() inside Cavity class to handle this.
- Implement function
public void willClose()
in RFLDocument. This function is called when a document is about to close. In this function all cavities from the document have to be disconnected. - Same for PV in the second table.
- Implement function
public void applicationWillQuit()
in Main. This function is called when the application is about to quit. Put final network cleanup thereProxyPV.closeAll()
.