I frequently hear that it would be difficult to use libSBML from Tomcat. So I figured I take some time to investigate what the problems could be. In the process I rewrote the SBML Online Validator to use libSBML java bindings and tomcat. It turned out that libSBML is actually easy enough to set up to be used by tomcat, one just has to take certain particularities of the java programming language (with respect to P/Invoke ) into account:
- libraries can only be loaded once
- native resources can only be accessed from the thread that created them
- you have hardly any control of the garbage collection, however all native classes have to be freed on the same thread as they were created on
- be careful that your elements do not go out of scope (i.e.: even if you are working with SBML Models, you can not let the SBML Document get out of scope)
I’ve written all this up and published it on github, it would be great to hear what you think about it. There you will find:
No comments:
Post a Comment