Uno/Remote/Tutorials/Disposing Remote Bridges

From Apache OpenOffice Wiki
< Uno‎ | Remote‎ | Tutorials
Jump to: navigation, search

The connection between a Java Uno based client and the office keeps being established as long as objects are mapped from one side to the other (e.g. Java holds a reference to an Uno object of the office process). The Java GC (respectively the "finalize" method) is utilized to effectively clean up unused objects. As the Java GC (which actually calls the "finalize" method) does only run under some memory pressure and typically not during idle times, any unused objects do not become freed and the connection keeps being established.

You may want to try calling the GC in a loop, until nothing becomes released any more ...

Unfortunately there is no real solution to this problem, as Java does not support any synchronous destruction (though it actually could do so), while asking programmers to explicitly take care does not seem to be reasonable ...

By the way, you can ask the BridgeFactory for the established remote bridges, which you can dispose explicitly by using the XComponent interface. This leads to the termination of all associated threads.

Personal tools