1 / 9

Objectivity/DB & JAVA

Objectivity/DB & JAVA. by Antek Baranski Norsys Technology AB. Overview. Objy class registration. JAVA reflections. JAVA GC. Non-recursive tree traversal. Objy class registration. Can be slow. Do it up-front. i.e. on creating the connection, with registerClass. How does it work?

mandel
Download Presentation

Objectivity/DB & JAVA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Objectivity/DB & JAVA by Antek Baranski Norsys Technology AB Objectivity/DB & JAVA

  2. Overview • Objy class registration. • JAVA reflections. • JAVA GC. • Non-recursive tree traversal. Objectivity/DB & JAVA

  3. Objy class registration • Can be slow. • Do it up-front. • i.e. on creating the connection, with registerClass. • How does it work? • VM and Objy Schema class comparison. • field - field comparison. • Inheritance tree. • i.e. JAVA reflection. Objectivity/DB & JAVA

  4. JAVA reflections • Expensive. • High memory usage. • Slows down JAVA VM. • JAVA GC works overtime. • Unpredictable application performance. • Possible solution: • “Pre”-reflect all classes on class-registration. • Pity we can’t use Objy registerClass reflections. Objectivity/DB & JAVA

  5. JAVA GC • Application performance unpredictable. • JAVA 1, up to 30% difference. • JAVA 2, ‘only’ 13% difference. • Possible solution call GC yourself. publicstaticvoid yieldToGC() { Thread myThread = Thread.currentThread(); int myPriority = myThread.getPriority(); myThread.setPriority(Thread.MIN_PRIORITY); System.gc(); myThread.yield(); myThread.setPriority(myPriority); } Objectivity/DB & JAVA

  6. Non-recursive tree traversal (1) publicclass TIterator { publicint parentItr = -1; publicint childItr = -1; publicint scope = 0; public com.objy.db.app.Iterator itr = null; public TIterator() { parentItr = -1; childItr = -1; scope = 0; itr = null; }; public TIterator(com.objy.db.app.Iterator itrIn) { parentItr = -1; childItr = -1; scope = 0; itr = itrIn; }; public TIterator(int parent, int level, com.objy.db.app.Iterator itrIn) { parentItr = parent; childItr = -1; scope = level; itr = itrIn; }; } Objectivity/DB & JAVA

  7. Non-recursive tree traversal (2) publicboolean nextObj(int iterator) { int itr = 0; int parent = 0; int scope = 0; int child = 0; try { parent = this.itr[iterator].parentItr; scope = this.itr[iterator].scope; child = this.itr[iterator].childItr; if (child != -1) { while (this.itr[child].childItr != -1) { parent = child; child = this.itr[child].childItr; } if (this.itr[child].itr.hasMoreElements()) { moi = (MOInfo) this.itr[child].itr.nextElement(); if (moi.children.exists()) { if (this.itr[child].scope != 0) { itr = this.createItr(child, this.itr[child].scope, moi.children.scan()); this.itr[child].childItr = itr; } } returntrue; } // if (child != -1) Objectivity/DB & JAVA

  8. Non-recursive tree traversal (3) this.deleteItr(child); while (parent != -1) { this.itr[parent].childItr = -1; if (this.itr[parent].itr.hasMoreElements()) { moi = (MOInfo) this.itr[parent].itr.nextElement(); if (moi.children.exists()) { if (this.itr[parent].scope != 0) { itr = this.createItr(parent, this.itr[parent].scope, moi.children.scan()); this.itr[parent].childItr = itr; } } returntrue; } child = parent; parent = this.itr[parent].parentItr; if (parent != -1) { this.deleteItr(child); } } } // while (parent != -1) Objectivity/DB & JAVA

  9. Non-recursive tree traversal (4) if (this.itr[iterator].itr.hasMoreElements()) { moi = (MOInfo) this.itr[iterator].itr.nextElement(); if (scope != 0) { if (moi.children.exists()) { itr = this.createItr(iterator, scope, moi.children.scan()); this.itr[iterator].childItr = itr; } } returntrue; } returnfalse; } // try Objectivity/DB & JAVA

More Related