On Objectstacks
I also changed the used JBullet parts, so that they dont use Objectstacks. Objectstacks were introduced to manage temporary objects in a threadsafe way. There are 3 possibilities to deal with temporary objects:
- 1) Just instantiate a temporary object as you need it. Problem: this can result in a lot instantiated objects, garbage collector has alot todo, runtime performance might drop. Though, intelligent jit-compilers could possibly handle multiply temporary instantiations and could in a way inline them..
- 2) Add (private) auxiliary objectvariables to the class. You can use this objects in computation and dont need to instantiate new ones. Problem: if different threads invoke the same method at the same time, an object could be used twice, with unexpected results. This approach is not thread-safe.
- 3) Use objectstacks. Retrieve auxiliary objects from a pool and return them to the pool, when computation is over. This way in most cases only limited number of instantitions is needed (opposed to possibly unlimited instantiations in approach 1) and this method is threadsafe (opposed to approach 2).
How to build
- Make sure, that a JDK is installed.
- Put the source file into a directory 'net/plsw/bullet'.
- Compile it with 'javac net/plsw/bullet/BoxDemo.java'.
- Run it with 'java net.plsw.bullet.BoxDemo'.
1 Kommentar:
Gravitation /keine Erfindung (irgendeines) Gottes
sondern ist entstanden aus nichts und abernichts / so Hawking
keiner war da, der vor der Schaffung des Universums
daran dachte, dass Gravitation notwendig ist, ansonst
es schon gar nicht zu einem Universum kommen konnte
Kommentar veröffentlichen